diff options
Diffstat (limited to 'sources/shiboken2')
5 files changed, 14 insertions, 5 deletions
diff --git a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp index cb8042561..66df0fd94 100644 --- a/sources/shiboken2/libshiboken/pep384impl.cpp +++ b/sources/shiboken2/libshiboken/pep384impl.cpp @@ -754,11 +754,13 @@ _Pep_PrivateMangle(PyObject *self, PyObject *name) #ifndef Py_LIMITED_API return _Py_Mangle(privateobj, name); #else - // For some reason, _Py_Mangle is not in the Limited API. Why? - size_t plen = PyUnicode_GET_LENGTH(privateobj); + // PYSIDE-1436: _Py_Mangle is no longer exposed; implement it always. + // The rest of this function is our own implementation of _Py_Mangle. + // Please compare the original function in compile.c . + size_t plen = PyUnicode_GET_LENGTH(privateobj.object()); /* Strip leading underscores from class name */ size_t ipriv = 0; - while (PyUnicode_READ_CHAR(privateobj, ipriv) == '_') + while (PyUnicode_READ_CHAR(privateobj.object(), ipriv) == '_') ipriv++; if (ipriv == plen) { Py_INCREF(name); diff --git a/sources/shiboken2/libshiboken/pep384impl.h b/sources/shiboken2/libshiboken/pep384impl.h index 7a6f57fcd..eb65596cc 100644 --- a/sources/shiboken2/libshiboken/pep384impl.h +++ b/sources/shiboken2/libshiboken/pep384impl.h @@ -40,6 +40,11 @@ #ifndef PEP384IMPL_H #define PEP384IMPL_H +// PYSIDE-1436: Adapt to Python 3.10 +#if PY_VERSION_HEX < 0x030900A4 +# define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0) +#endif + extern "C" { @@ -327,7 +332,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 < 0x0309FFFF) + PY_VERSION_HEX < 0x030AFFFF) #if !PYTHON_BUFFER_VERSION_COMPATIBLE # error Please check the buffer compatibility for this python version! #endif diff --git a/sources/shiboken2/libshiboken/sbkstring.cpp b/sources/shiboken2/libshiboken/sbkstring.cpp index 918aae756..077fb531b 100644 --- a/sources/shiboken2/libshiboken/sbkstring.cpp +++ b/sources/shiboken2/libshiboken/sbkstring.cpp @@ -247,7 +247,7 @@ static void finalizeStaticStrings() { auto &set = staticStrings(); for (PyObject *ob : set) { - Py_REFCNT(ob) = 1; + Py_SET_REFCNT(ob, 1); Py_DECREF(ob); } set.clear(); diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py index 6fadd19d5..f701d83c8 100644 --- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py +++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py @@ -300,6 +300,7 @@ type_map.update({ "zero(object)": None, "zero(str)": "", "zero(typing.Any)": None, + "zero(Any)": None, }) type_map.update({ diff --git a/sources/shiboken2/tests/samplebinding/time_test.py b/sources/shiboken2/tests/samplebinding/time_test.py index f8b35e7b7..3b8f232c7 100644 --- a/sources/shiboken2/tests/samplebinding/time_test.py +++ b/sources/shiboken2/tests/samplebinding/time_test.py @@ -130,6 +130,7 @@ class TimeTest(unittest.TestCase): result = time.somethingCompletelyDifferent(1, 2, ImplicitConv.CtorOne) self.assertEqual(result, Time.ThreeArgs) + # PYSIDE-1436: These tests crash at shutdown due to `assert(Not)?Equal`. def testCompareWithPythonTime(self): time = Time(12, 32, 5) py = datetime.time(12, 32, 5) |