[issue38205] Python no longer compiles without small integer singletons

2019-09-19 Thread STINNER Victor
STINNER Victor added the comment: I wrote PR 16280: "Convert Py_UNREACHABLE() macro to a function". This change fix this issue but also enhance Py_UNREACHABLE() which now dumps the Python traceback where the bug occurs. See my example: https://github.com/python/cpython/pull/16280#issuecomment

[issue38205] Python no longer compiles without small integer singletons

2019-09-19 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +15865 pull_request: https://github.com/python/cpython/pull/16280 ___ Python tracker ___ __

[issue38205] Python no longer compiles without small integer singletons

2019-09-19 Thread STINNER Victor
STINNER Victor added the comment: I like the idea of implementing Py_UNREACHABLE() as a function. Would it make sense to even declare it as a regular function rather than a static inline function? What is the benefit of inlining here? Inlining can make the code larger, rather than a function

[issue38205] Python no longer compiles without small integer singletons

2019-09-18 Thread Ammar Askar
Ammar Askar added the comment: For the control path warning, that can be fixed by just hinting to the compiler that the function doesn't return like so: # ifdef __GNUC__ __attribute__ ((noreturn)) # elif defined(_MSC_VER) __declspec(noreturn) # endif static inline void _Py_UNREA

[issue38205] Python no longer compiles without small integer singletons

2019-09-18 Thread Ma Lin
Ma Lin added the comment: PR 16270 use Py_UNREACHABLE() in a single line. It solves this particular issue. -- ___ Python tracker ___ __

[issue38205] Python no longer compiles without small integer singletons

2019-09-18 Thread Ma Lin
Change by Ma Lin : -- keywords: +patch pull_requests: +15860 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16270 ___ Python tracker ___ _

[issue38205] Python no longer compiles without small integer singletons

2019-09-18 Thread Ma Lin
Ma Lin added the comment: If use static inline function, and Py_UNREACHABLE() inside an if-else branch that should return a value, compiler may emit warning: https://godbolt.org/z/YtcNSf MSVC v19.14: warning C4715: 'test': not all control paths return a value clang 8.0.0: war

[issue38205] Python no longer compiles without small integer singletons

2019-09-18 Thread Zachary Ware
Zachary Ware added the comment: I have poked at this a bit and have an implementation that defines a `static inline void _Py_Unreachable()` in pymacro.h, see https://github.com/zware/cpython/commit/d07b4255dc1170155e18db0fea99ec1cb29c2f0a This works on at least macOS and Windows, and we also

[issue38205] Python no longer compiles without small integer singletons

2019-09-18 Thread Gregory P. Smith
Gregory P. Smith added the comment: While I don't like how that get_small_int macro is defined... and I don't like that Py_UNREACHABLE() was usable as an expression in the past... it is probably best to just revert 3ab61473ba7f3dca32d779ec2766a4faa0657923. The choice to use a macro for this

[issue38205] Python no longer compiles without small integer singletons

2019-09-18 Thread Zachary Ware
Zachary Ware added the comment: Whoops :(. Fixing this is beyond my C skill. I'd rather not lose the easter egg, but if it can't be fixed properly then 3ab61473ba7f3dca32d779ec2766a4faa0657923 should just be reverted. -- nosy: +gregory.p.smith _

[issue38205] Python no longer compiles without small integer singletons

2019-09-18 Thread STINNER Victor
STINNER Victor added the comment: > Before the mentioned commit Py_UNREACHABLE() was an expression, now it's a > block. Right, it was changed by: commit 3ab61473ba7f3dca32d779ec2766a4faa0657923 Author: Zachary Ware Date: Thu Sep 12 13:35:48 2019 +0100 Enhance Py_UNREACHABLE macro (G

[issue38205] Python no longer compiles without small integer singletons

2019-09-17 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: Also quote from Py_UNREACHABLE() doc: > Use this in places where you might be tempted to put an assert(0) or abort() > call. https://github.com/python/cpython/commit/6b519985d23bd0f0bd072b5d5d5f2c60a81a19f2 does exactly that, it replaces assert(0) with Py

[issue38205] Python no longer compiles without small integer singletons

2019-09-17 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: I believe that the problem is caused by the change in Py_UNREACHABLE() (https://github.com/python/cpython/commit/3ab61473ba7f3dca32d779ec2766a4faa0657923). Before the mentioned commit Py_UNREACHABLE() was an expression, now it's a block. Py_UNREACHABLE() ma

[issue38205] Python no longer compiles without small integer singletons

2019-09-17 Thread STINNER Victor
STINNER Victor added the comment: See https://bugs.python.org/issue37812#msg352670 and https://bugs.python.org/issue38015 -- ___ Python tracker ___ __

[issue38205] Python no longer compiles without small integer singletons

2019-09-17 Thread Ma Lin
Ma Lin added the comment: We can change Py_UNREACHABLE() to assert(0) in longobject.c Or remove the article in Py_UNREACHABLE() -- ___ Python tracker ___ _

[issue38205] Python no longer compiles without small integer singletons

2019-09-17 Thread Ma Lin
Ma Lin added the comment: This commit changed Py_UNREACHABLE() five days ago: https://github.com/python/cpython/commit/3ab61473ba7f3dca32d779ec2766a4faa0657923 If remove this change, it can be compiled successfully. -- nosy: +Ma Lin ___ Python tra

[issue38205] Python no longer compiles without small integer singletons

2019-09-17 Thread STINNER Victor
New submission from STINNER Victor : 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 @@ -