aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken
diff options
context:
space:
mode:
authorBoxiang Sun <daetalusun@gmail.com>2018-07-04 06:49:04 +0800
committerChristian Tismer <tismer@stackless.com>2018-07-05 15:12:24 +0000
commitf16328b8705f39a10216356d3c14f28607f62a72 (patch)
tree5623c3fe2cbe905ceb7a485bcd27a499671ebe78 /sources/shiboken2/libshiboken
parenta378ca8fdb33f040112762aad402ffb7c111d601 (diff)
Remove Py_TPFLAGS_HAVE_VERSION_TAG in Python 3
The Py_TPFLAGS_DEFAULT in Python 3 has the Py_TPFLAGS_HAVE_VERSION_TAG flag, which causes the type attribute cache in _PyType_Lookup. According to the Shiboken implementation for Python 2, this is not we expected. So remove the Py_TPFLAGS_HAVE_VERSION_TAG flag from Py_TPFLAGS_DEFAULT in Python 3. Task-number: PYSIDE-60 Change-Id: Id731a59b65640eb5adea56fe06e0deb58ac4a168 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/libshiboken')
-rw-r--r--sources/shiboken2/libshiboken/sbkpython.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sources/shiboken2/libshiboken/sbkpython.h b/sources/shiboken2/libshiboken/sbkpython.h
index a26c318d..fbac016e 100644
--- a/sources/shiboken2/libshiboken/sbkpython.h
+++ b/sources/shiboken2/libshiboken/sbkpython.h
@@ -71,6 +71,12 @@
#define PyInt_AsSsize_t(x) PyLong_AsSsize_t(x)
#define PyString_Type PyUnicode_Type
+ // In Python 3, Py_TPFLAGS_DEFAULT contains Py_TPFLAGS_HAVE_VERSION_TAG,
+ // which will trigger the attribute cache, which is not intended in Qt for Python.
+ // Use a customized Py_TPFLAGS_DEFAULT by defining Py_TPFLAGS_HAVE_VERSION_TAG = 0.
+ #undef Py_TPFLAGS_HAVE_VERSION_TAG
+ #define Py_TPFLAGS_HAVE_VERSION_TAG (0)
+
#else
// Note: if there wasn't for the old-style classes, only a PyNumber_Check would suffice.
#define SbkNumber_Check(X) \