Skip to content

PyLong_FromLong() potentially returns irregular object when small_ints[] isn't used #69408

Closed

Description

@s-wakaba
mannequin
BPO 25221
Nosy @mdickinson
Files
  • longobject.c.patch: patch for Ojbects/longobject.c
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/mdickinson'
    closed_at = <Date 2016-09-10.19:21:26.823>
    created_at = <Date 2015-09-23.17:23:52.512>
    labels = ['interpreter-core', 'type-bug']
    title = "PyLong_FromLong() potentially returns irregular object when small_ints[] isn't used"
    updated_at = <Date 2016-09-10.19:21:26.821>
    user = 'https://bugs.python.org/s-wakaba'

    bugs.python.org fields:

    activity = <Date 2016-09-10.19:21:26.821>
    actor = 'mark.dickinson'
    assignee = 'mark.dickinson'
    closed = True
    closed_date = <Date 2016-09-10.19:21:26.823>
    closer = 'mark.dickinson'
    components = ['Interpreter Core']
    creation = <Date 2015-09-23.17:23:52.512>
    creator = 's-wakaba'
    dependencies = []
    files = ['40555']
    hgrepos = []
    issue_num = 25221
    keywords = ['patch']
    message_count = 3.0
    messages = ['251436', '275680', '275681']
    nosy_count = 3.0
    nosy_names = ['mark.dickinson', 's-wakaba', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue25221'
    versions = ['Python 3.5', 'Python 3.6']

    Activity

    1. s-wakaba commented on Sep 23, 2015

      s-wakabamannequin
      MannequinAuthor

      When compiling cpython with specifying NSMALLPOSINTS and NSMALLNEGINTS macros as zero to skip making small_ints[] array, like following command, process couldn't finish.

      $ ./configure CPPFLAGS='-DNSMALLPOSINTS=0 -DNSMALLNEGINTS=0'
      $ make

      The reason looks a problem that PyLong_FromLong(0) returns irregular int object: Py_SIZE(zero_int) must be 0, but it becomes 1.

      maybe this problem never appears in actual cases, but in "longobject.c", it still looks supported to compile without small_ints[].
      I don't know it should be fixed or not. but, as a result, I could compile cpython after addition of one line like attached patch.
      Could you confirm this point?

      Thanks.

    2. added
      interpreter-core(Objects, Python, Grammar, and Parser dirs)
      type-bugAn unexpected behavior, bug, or error
      on Sep 23, 2015
    3. self-assigned this
      on Sep 10, 2016
    4. python-dev commented on Sep 10, 2016

      python-devmannequin
      Mannequin

      New changeset 9eb0f7762999 by Mark Dickinson in branch '3.5':
      Issue bpo-25221: Fix corrupted result from PyLong_FromLong(0) when Python is compiled with NSMALLPOSINTS = 0.
      https://hg.python.org/cpython/rev/9eb0f7762999

      New changeset c7b48798dbaa by Mark Dickinson in branch 'default':
      Issue bpo-25221: merge from 3.5.
      https://hg.python.org/cpython/rev/c7b48798dbaa

    5. mdickinson commented on Sep 10, 2016

      @mdickinson
      Member

      Thanks for the report! Fixed.

    6. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions