You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PyLong_FromLong() potentially returns irregular object when small_ints[] isn't used #69408
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?
Activity
s-wakaba commentedon 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' $ makeThe 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.
python-dev commentedon 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 commentedon Sep 10, 2016
Thanks for the report! Fixed.