Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
s-wakaba mannequin opened this issue Sep 23, 2015 · 3 comments
Closed

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

s-wakaba mannequin opened this issue Sep 23, 2015 · 3 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@s-wakaba
Copy link
Mannequin

s-wakaba mannequin commented Sep 23, 2015

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']

    @s-wakaba
    Copy link
    Mannequin Author

    s-wakaba mannequin commented Sep 23, 2015

    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.

    @s-wakaba s-wakaba mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Sep 23, 2015
    @mdickinson mdickinson self-assigned this Sep 10, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 10, 2016

    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

    @mdickinson
    Copy link
    Member

    Thanks for the report! Fixed.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant