diff options
Diffstat (limited to 'sources/shiboken2/libshiboken/pep384impl.h')
-rw-r--r-- | sources/shiboken2/libshiboken/pep384impl.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/sources/shiboken2/libshiboken/pep384impl.h b/sources/shiboken2/libshiboken/pep384impl.h index 1aa7e6fc0..e9f65e446 100644 --- a/sources/shiboken2/libshiboken/pep384impl.h +++ b/sources/shiboken2/libshiboken/pep384impl.h @@ -89,7 +89,7 @@ typedef struct _typeobject { Py_ssize_t tp_basicsize; void *X03; // Py_ssize_t tp_itemsize; void *X04; // destructor tp_dealloc; - void *X05; // printfunc tp_print; + void *X05; // Py_ssize_t tp_vectorcall_offset; void *X06; // getattrfunc tp_getattr; void *X07; // setattrfunc tp_setattr; void *X08; // PyAsyncMethods *tp_as_async; @@ -103,7 +103,7 @@ typedef struct _typeobject { void *X16; // getattrofunc tp_getattro; void *X17; // setattrofunc tp_setattro; void *X18; // PyBufferProcs *tp_as_buffer; - void *X19; // unsigned long tp_flags; + unsigned long tp_flags; void *X20; // const char *tp_doc; traverseproc tp_traverse; inquiry tp_clear; @@ -129,6 +129,13 @@ typedef struct _typeobject { } PyTypeObject; +#ifndef PyObject_IS_GC +/* Test if an object has a GC head */ +#define PyObject_IS_GC(o) \ + (PyType_IS_GC(Py_TYPE(o)) \ + && (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) +#endif + // This was a macro error in the limited API from the beginning. // It was fixed in Python master, but did make it only in Python 3.8 . #define PY_ISSUE33738_SOLVED 0x03080000 @@ -292,7 +299,7 @@ LIBSHIBOKEN_API PyObject *PyRun_String(const char *, int, PyObject *, PyObject * // But this is no problem as we check it's validity for every version. #define PYTHON_BUFFER_VERSION_COMPATIBLE (PY_VERSION_HEX >= 0x03030000 && \ - PY_VERSION_HEX < 0x0307FFFF) + PY_VERSION_HEX < 0x0308FFFF) #if !PYTHON_BUFFER_VERSION_COMPATIBLE # error Please check the buffer compatibility for this python version! #endif @@ -488,6 +495,19 @@ extern LIBSHIBOKEN_API PyTypeObject *PepMethodDescr_TypePtr; /***************************************************************************** * + * Runtime support for Python 3.8 incompatibilities + * + */ + +#ifndef Py_TPFLAGS_METHOD_DESCRIPTOR +/* Objects behave like an unbound method */ +#define Py_TPFLAGS_METHOD_DESCRIPTOR (1UL << 17) +#endif + +extern LIBSHIBOKEN_API int PepRuntime_38_flag; + +/***************************************************************************** + * * Module Initialization * */ |