Commit f4fe3c42 authored by Ronan Lamy's avatar Ronan Lamy

Add flag CYTHON_USE_TP_FINALIZEto control whether tp_finalize is used.

Disable it on pypy3, since it doesn't support PEP 442 yet.
parent 1546cd7b
...@@ -1408,7 +1408,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1408,7 +1408,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if not is_final_type: if not is_final_type:
# in Py3.4+, call tp_finalize() as early as possible # in Py3.4+, call tp_finalize() as early as possible
code.putln("#if PY_VERSION_HEX >= 0x030400a1") code.putln("#if CYTHON_USE_TP_FINALIZE")
if needs_gc: if needs_gc:
finalised_check = '!_PyGC_FINALIZED(o)' finalised_check = '!_PyGC_FINALIZED(o)'
else: else:
......
...@@ -387,13 +387,13 @@ PyTypeObject __pyx_AsyncGenType_type = { ...@@ -387,13 +387,13 @@ PyTypeObject __pyx_AsyncGenType_type = {
0, /* tp_cache */ 0, /* tp_cache */
0, /* tp_subclasses */ 0, /* tp_subclasses */
0, /* tp_weaklist */ 0, /* tp_weaklist */
#if PY_VERSION_HEX >= 0x030400a1 #if CYTHON_USE_TP_FINALIZE
0, /*tp_del*/ 0, /*tp_del*/
#else #else
__Pyx_Coroutine_del, /*tp_del*/ __Pyx_Coroutine_del, /*tp_del*/
#endif #endif
0, /* tp_version_tag */ 0, /* tp_version_tag */
#if PY_VERSION_HEX >= 0x030400a1 #if CYTHON_USE_TP_FINALIZE
__Pyx_Coroutine_del, /* tp_finalize */ __Pyx_Coroutine_del, /* tp_finalize */
#endif #endif
}; };
......
...@@ -1553,13 +1553,13 @@ static PyTypeObject __pyx_CoroutineType_type = { ...@@ -1553,13 +1553,13 @@ static PyTypeObject __pyx_CoroutineType_type = {
0, /*tp_cache*/ 0, /*tp_cache*/
0, /*tp_subclasses*/ 0, /*tp_subclasses*/
0, /*tp_weaklist*/ 0, /*tp_weaklist*/
#if PY_VERSION_HEX >= 0x030400a1 #if CYTHON_USE_TP_FINALIZE
0, /*tp_del*/ 0, /*tp_del*/
#else #else
__Pyx_Coroutine_del, /*tp_del*/ __Pyx_Coroutine_del, /*tp_del*/
#endif #endif
0, /*tp_version_tag*/ 0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1 #if CYTHON_USE_TP_FINALIZE
__Pyx_Coroutine_del, /*tp_finalize*/ __Pyx_Coroutine_del, /*tp_finalize*/
#endif #endif
}; };
...@@ -1653,13 +1653,13 @@ static PyTypeObject __pyx_GeneratorType_type = { ...@@ -1653,13 +1653,13 @@ static PyTypeObject __pyx_GeneratorType_type = {
0, /*tp_cache*/ 0, /*tp_cache*/
0, /*tp_subclasses*/ 0, /*tp_subclasses*/
0, /*tp_weaklist*/ 0, /*tp_weaklist*/
#if PY_VERSION_HEX >= 0x030400a1 #if CYTHON_USE_TP_FINALIZE
0, /*tp_del*/ 0, /*tp_del*/
#else #else
__Pyx_Coroutine_del, /*tp_del*/ __Pyx_Coroutine_del, /*tp_del*/
#endif #endif
0, /*tp_version_tag*/ 0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1 #if CYTHON_USE_TP_FINALIZE
__Pyx_Coroutine_del, /*tp_finalize*/ __Pyx_Coroutine_del, /*tp_finalize*/
#endif #endif
}; };
......
...@@ -77,6 +77,8 @@ ...@@ -77,6 +77,8 @@
#define CYTHON_FAST_PYCALL 0 #define CYTHON_FAST_PYCALL 0
#undef CYTHON_PEP489_MULTI_PHASE_INIT #undef CYTHON_PEP489_MULTI_PHASE_INIT
#define CYTHON_PEP489_MULTI_PHASE_INIT 0 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
#undef CYTHON_USE_TP_FINALIZE
#define CYTHON_USE_TP_FINALIZE 0
#elif defined(PYSTON_VERSION) #elif defined(PYSTON_VERSION)
#define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYPY 0
...@@ -114,6 +116,8 @@ ...@@ -114,6 +116,8 @@
#define CYTHON_FAST_PYCALL 0 #define CYTHON_FAST_PYCALL 0
#undef CYTHON_PEP489_MULTI_PHASE_INIT #undef CYTHON_PEP489_MULTI_PHASE_INIT
#define CYTHON_PEP489_MULTI_PHASE_INIT 0 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
#undef CYTHON_USE_TP_FINALIZE
#define CYTHON_USE_TP_FINALIZE 0
#else #else
#define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYPY 0
...@@ -172,6 +176,9 @@ ...@@ -172,6 +176,9 @@
#ifndef CYTHON_PEP489_MULTI_PHASE_INIT #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
#define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
#endif #endif
#ifndef CYTHON_USE_TP_FINALIZE
#define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
#endif
#endif #endif
#if !defined(CYTHON_FAST_PYCCALL) #if !defined(CYTHON_FAST_PYCCALL)
......
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