From d90348de1e59a7e19085b29ed7af4c6266f1625c Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Sat, 14 Oct 2023 11:37:51 +0200 Subject: Support running PySide on Python 3.12, cleanup In the course of fixing 3.12 issues, a 3.11 fix for PyEnum was missing that created a 3.11 error. A bug with deployment was fixed but not reflected in the tests. This was only visible for pyenv users. Also fixes a minor cosmetic bug introduced by "Python 3.12: Fix the structure of class property" Task-number: PYSIDE-2230 Change-Id: I3a6bd6426e23168dfccdda17b408f193aacd28a0 Pick-to: 6.5 6.2 Reviewed-by: Qt CI Bot Reviewed-by: Cristian Maureira-Fredes (cherry picked from commit 29967cb08e6dfd19b0e49013d3b936f9fd18c6a2) Reviewed-by: Qt Cherry-pick Bot --- sources/pyside6/libpyside/class_property.h | 2 +- sources/pyside6/tests/tools/pyside6-deploy/test_pyside6_deploy.py | 4 ++++ sources/shiboken6/libshiboken/sbkfeature_base.cpp | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sources/pyside6/libpyside/class_property.h b/sources/pyside6/libpyside/class_property.h index 4942e0ef3..f2ed29f1f 100644 --- a/sources/pyside6/libpyside/class_property.h +++ b/sources/pyside6/libpyside/class_property.h @@ -27,7 +27,7 @@ struct propertyobject310 { // Note: This is a problem with Limited API: We have no direct access. // You need to pick it from runtime info. PyObject *prop_name; - int getter_doc; + int getter_doc; }; PYSIDE_API PyTypeObject *PyClassProperty_TypeF(); diff --git a/sources/pyside6/tests/tools/pyside6-deploy/test_pyside6_deploy.py b/sources/pyside6/tests/tools/pyside6-deploy/test_pyside6_deploy.py index 26b9d8467..3a54e2b88 100644 --- a/sources/pyside6/tests/tools/pyside6-deploy/test_pyside6_deploy.py +++ b/sources/pyside6/tests/tools/pyside6-deploy/test_pyside6_deploy.py @@ -26,6 +26,10 @@ class ConfigFile: class TestPySide6Deploy(unittest.TestCase): @classmethod def setUpClass(cls): + # PYSIDE-2230: A temporary patch that avoids the pyenv error. + # The final solution is too much for this quick fix. + if os.environ.get("PYENV_ROOT"): + del os.environ["PYENV_ROOT"] cls.pyside_root = Path(__file__).parents[5].resolve() example_root = cls.pyside_root / "examples" example_widgets = example_root / "widgets" / "widgets" / "tetrix" diff --git a/sources/shiboken6/libshiboken/sbkfeature_base.cpp b/sources/shiboken6/libshiboken/sbkfeature_base.cpp index 330521dec..d075b565c 100644 --- a/sources/shiboken6/libshiboken/sbkfeature_base.cpp +++ b/sources/shiboken6/libshiboken/sbkfeature_base.cpp @@ -76,6 +76,7 @@ static int const CALL = 171; // Python 3.11 static int const PRECALL = 166; // we have "big instructions" with gaps after them +static int const LOAD_METHOD_GAP_311 = 10 * 2; static int const LOAD_ATTR_GAP_311 = 4 * 2; static int const LOAD_ATTR_GAP = 9 * 2; // Python 3.7 - 3.10 @@ -136,7 +137,9 @@ static bool currentOpcode_Is_CallMethNoArgs() // With Python 3.11, the opcodes get bigger and change a bit. // Note: The new adaptive opcodes are elegantly hidden and we // don't need to take care of them. - if (opcode1 == LOAD_ATTR) + if (opcode1 == LOAD_METHOD) + f_lasti += LOAD_METHOD_GAP_311; + else if (opcode1 == LOAD_ATTR) f_lasti += LOAD_ATTR_GAP_311; else return false; -- cgit v1.2.3