summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2019-10-08 21:27:06 +0100
committerStefan Behnel <stefan_ml@behnel.de>2019-10-08 22:27:06 +0200
commit00a1d4cb3b4ed84e50a4902518a05d02f93e95bb (patch)
treee85f8672ddb7e88b439427523cb5f4ec2f3014fc
parent074362b47093febfe5273ea7a00f4ba5ded6e73f (diff)
downloadcython-00a1d4cb3b4ed84e50a4902518a05d02f93e95bb.tar.gz
Explicitly initialize tp_print in Python 3.8 (GH-3171)
Explicitly initialize tp_print in Python 3.8 When compiling cython-generated extension modules in Python3.8rc1 this error is emitted by the compiler: _ext.cpp:8104:1: error: missing initializer for member ‘_typeobject::tp_print’ [-Werror=missing-field-initializers] The reason is that Python3.8 moved the tp_print slot (d917cfe4051) to the end of the _typeobject struct and reused the original position for tp_vectorcall_offset. The current generated code does not initialize the deprecated tp_print slot that was moved to the end of the struct.
-rw-r--r--Cython/Compiler/TypeSlots.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Cython/Compiler/TypeSlots.py b/Cython/Compiler/TypeSlots.py
index 1be18f767..dca313ca5 100644
--- a/Cython/Compiler/TypeSlots.py
+++ b/Cython/Compiler/TypeSlots.py
@@ -893,7 +893,8 @@ PyAsyncMethods = (
slot_table = (
ConstructorSlot("tp_dealloc", '__dealloc__'),
- EmptySlot("tp_print"), #MethodSlot(printfunc, "tp_print", "__print__"),
+ EmptySlot("tp_print", ifdef="PY_VERSION_HEX < 0x030800b4"),
+ EmptySlot("tp_vectorcall_offset", ifdef="PY_VERSION_HEX >= 0x030800b4"),
EmptySlot("tp_getattr"),
EmptySlot("tp_setattr"),
@@ -956,6 +957,7 @@ slot_table = (
EmptySlot("tp_version_tag"),
EmptySlot("tp_finalize", ifdef="PY_VERSION_HEX >= 0x030400a1"),
EmptySlot("tp_vectorcall", ifdef="PY_VERSION_HEX >= 0x030800b1"),
+ EmptySlot("tp_print", ifdef="PY_VERSION_HEX >= 0x030800b4"),
)
#------------------------------------------------------------------------------------------