This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PyLong_FromLong() potentially returns irregular object when small_ints[] isn't used
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: mark.dickinson, python-dev, s-wakaba
Priority: normal Keywords: patch

Created on 2015-09-23 17:23 by s-wakaba, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
longobject.c.patch s-wakaba, 2015-09-23 17:23 patch for Ojbects/longobject.c
Messages (3)
msg251436 - (view) Author: (s-wakaba) Date: 2015-09-23 17:23
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.
msg275680 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-10 19:20
New changeset 9eb0f7762999 by Mark Dickinson in branch '3.5':
Issue #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 #25221: merge from 3.5.
https://hg.python.org/cpython/rev/c7b48798dbaa
msg275681 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2016-09-10 19:21
Thanks for the report! Fixed.
History
Date User Action Args
2022-04-11 14:58:21adminsetgithub: 69408
2016-09-10 19:21:26mark.dickinsonsetstatus: open -> closed
resolution: fixed
messages: + msg275681

stage: commit review -> resolved
2016-09-10 19:20:23python-devsetnosy: + python-dev
messages: + msg275680
2016-09-10 19:02:53mark.dickinsonsetassignee: mark.dickinson
stage: commit review

nosy: + mark.dickinson
versions: + Python 3.6
2015-09-23 17:23:52s-wakabacreate