Commit baa08c56 authored by Pablo Galindo's avatar Pablo Galindo Committed by Stefan Behnel

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.
parent edbd6468
...@@ -825,7 +825,8 @@ PyAsyncMethods = ( ...@@ -825,7 +825,8 @@ PyAsyncMethods = (
slot_table = ( slot_table = (
ConstructorSlot("tp_dealloc", '__dealloc__'), 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_getattr"),
EmptySlot("tp_setattr"), EmptySlot("tp_setattr"),
...@@ -888,6 +889,7 @@ slot_table = ( ...@@ -888,6 +889,7 @@ slot_table = (
EmptySlot("tp_version_tag"), EmptySlot("tp_version_tag"),
EmptySlot("tp_finalize", ifdef="PY_VERSION_HEX >= 0x030400a1"), EmptySlot("tp_finalize", ifdef="PY_VERSION_HEX >= 0x030400a1"),
EmptySlot("tp_vectorcall", ifdef="PY_VERSION_HEX >= 0x030800b1"), EmptySlot("tp_vectorcall", ifdef="PY_VERSION_HEX >= 0x030800b1"),
EmptySlot("tp_print", ifdef="PY_VERSION_HEX >= 0x030800b4"),
) )
#------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment