aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/pyside6/tests/QtCore/qenum_test.py6
-rw-r--r--sources/shiboken6/libshiboken/sbkenum.cpp2
2 files changed, 7 insertions, 1 deletions
diff --git a/sources/pyside6/tests/QtCore/qenum_test.py b/sources/pyside6/tests/QtCore/qenum_test.py
index 0d524505a..76caa9a37 100644
--- a/sources/pyside6/tests/QtCore/qenum_test.py
+++ b/sources/pyside6/tests/QtCore/qenum_test.py
@@ -77,6 +77,12 @@ class TestEnum(unittest.TestCase):
with self.assertRaises(TypeError):
a = k * 2.0
+ def testInherit(self):
+ class A(Qt.Key):
+ pass
+
+ self.assertEqual(A.Key_1, Qt.Key.Key_1)
+
@unittest.skipUnless(getattr(sys, "getobjects", None), "requires --with-trace-refs")
@unittest.skipUnless(getattr(sys, "gettotalrefcount", None), "requires --with-pydebug")
def testEnumNew_NoLeak(self):
diff --git a/sources/shiboken6/libshiboken/sbkenum.cpp b/sources/shiboken6/libshiboken/sbkenum.cpp
index a6f65c7ab..b97cff209 100644
--- a/sources/shiboken6/libshiboken/sbkenum.cpp
+++ b/sources/shiboken6/libshiboken/sbkenum.cpp
@@ -310,7 +310,7 @@ void SbkEnumTypeDealloc(PyObject *pyObj)
PyObject *SbkEnumTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
{
- auto type_new = reinterpret_cast<newfunc>(PyType_GetSlot(&PyType_Type, Py_tp_new));
+ auto type_new = reinterpret_cast<newfunc>(PyType_Type.tp_new);
auto newType = reinterpret_cast<SbkEnumType *>(type_new(metatype, args, kwds));
if (!newType)
return nullptr;