[issue38205] Python no longer compiles without small integer singletons

STINNER Victor report at bugs.python.org
Tue Sep 17 18:12:35 EDT 2019


New submission from STINNER Victor <vstinner at python.org>:

With the following change, Python no longer compiles. I'm sure that it compiled successfully 2 weeks ago.

diff --git a/Objects/longobject.c b/Objects/longobject.c
index 4cf2b0726e..0ad2609882 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -16,10 +16,10 @@ class int "PyObject *" "&PyLong_Type"
 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=ec0275e3422a36e3]*/
 
 #ifndef NSMALLPOSINTS
-#define NSMALLPOSINTS           257
+#define NSMALLPOSINTS           0
 #endif
 #ifndef NSMALLNEGINTS
-#define NSMALLNEGINTS           5
+#define NSMALLNEGINTS           0
 #endif
 
 _Py_IDENTIFIER(little);


Main GCC error:

Objects/longobject.c: In function '_PyLong_Copy':
./Include/pymacro.h:119:26: error: expected expression before 'do'
  119 | #define Py_UNREACHABLE() do { \
      |                          ^~
Objects/longobject.c:83:30: note: in expansion of macro 'Py_UNREACHABLE'
   83 | #define get_small_int(ival) (Py_UNREACHABLE(), NULL)
      |                              ^~~~~~~~~~~~~~


It seems to be a regression introduced by:

commit 6b519985d23bd0f0bd072b5d5d5f2c60a81a19f2
Author: animalize <animalize at users.noreply.github.com>
Date:   Fri Sep 6 14:00:56 2019 +0800

    replace inline function `is_small_int` with a macro version (GH-15710)

----------
components: Interpreter Core
messages: 352669
nosy: vstinner
priority: normal
severity: normal
status: open
title: Python no longer compiles without small integer singletons
type: compile error
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38205>
_______________________________________


More information about the Python-bugs-list mailing list