diff options
23 files changed, 307 insertions, 78 deletions
diff --git a/build_scripts/platforms/windows_desktop.py b/build_scripts/platforms/windows_desktop.py index 6b92c0823..4750015ab 100644 --- a/build_scripts/platforms/windows_desktop.py +++ b/build_scripts/platforms/windows_desktop.py @@ -274,7 +274,7 @@ def copy_msvc_redist_files(vars, redist_target_path): download_and_extract_7z(redist_url + zip_file, redist_target_path) except: print("download.qt.io is down, try with mirror") - redist_url = "https://www.funet.fi/pub/mirrors/download.qt-project.org/development_releases/prebuilt/vcredist/" + redist_url = "https://master.qt.io/development_releases/prebuilt/vcredist/" download_and_extract_7z(redist_url + zip_file, redist_target_path) else: print("Qt dependency DLLs (MSVC redist) will not be downloaded and extracted.") diff --git a/build_scripts/utils.py b/build_scripts/utils.py index 002d6ae5b..49839e2de 100644 --- a/build_scripts/utils.py +++ b/build_scripts/utils.py @@ -47,6 +47,7 @@ import subprocess import fnmatch import itertools import glob +from os.path import expanduser # There is no urllib.request in Python2 try: @@ -813,7 +814,36 @@ def ldd_get_paths_for_dependencies(dependencies_regex, executable_path=None, dep return paths -def ldd(executable_path): +def _ldd_ldd(executable_path): + """Helper for ldd(): + Returns ldd output of shared library dependencies for given + `executable_path`. + + Parameters + ---------- + executable_path : str + path to executable or shared library. + + Returns + ------- + output : str + the raw output retrieved from the dynamic linker. + """ + + output = '' + error = '' + try: + output_lines = run_process_output(['ldd', executable_path]) + output = '\n'.join(output_lines) + except Exception as e: + error = str(e) + if not output: + message = "ldd failed to query for dependent shared libraries of {}: {}".format(executable_path, error) + raise RuntimeError(message) + return output + + +def _ldd_ldso(executable_path): """ Returns ld.so output of shared library dependencies for given `executable_path`. @@ -873,6 +903,32 @@ def ldd(executable_path): "libraries of {} ".format(executable_path)) +def ldd(executable_path): + """ + Returns ldd output of shared library dependencies for given `executable_path`, + using either ldd or ld.so depending on availability. + + Parameters + ---------- + executable_path : str + path to executable or shared library. + + Returns + ------- + output : str + the raw output retrieved from the dynamic linker. + """ + result = '' + try: + result = _ldd_ldd(executable_path) + except RuntimeError as e: + message = "ldd: Falling back to ld.so ({})".format(str(e)) + log.warn(message) + if not result: + result = _ldd_ldso(executable_path) + return result + + def find_files_using_glob(path, pattern): """ Returns list of files that matched glob `pattern` in `path`. """ final_pattern = os.path.join(path, pattern) @@ -1102,7 +1158,7 @@ def install_pip_dependencies(env_pip, packages, upgrade=True): def get_qtci_virtualEnv(python_ver, host, hostArch, targetArch): - _pExe = "python" + _pExe = "python2" _env = "env{}".format(str(python_ver)) env_python = _env + "/bin/python" env_pip = _env + "/bin/pip" @@ -1174,3 +1230,16 @@ def get_ci_qmake_path(ci_install_dir, ci_host_os): return qmake_path + "\\bin\\qmake.exe" else: return qmake_path + "/bin/qmake" + + +def provisioning(): + home = expanduser("~") + file = "https://download.qt.io/development_releases/prebuilt/libclang/libclang-release_100-based-dyn-mac-universal.7z" + target = os.path.join(home, "libclang-dynlibs-10.0-universal") + try: + download_and_extract_7z(file, target) + except RuntimeError as e: + print("debug: Exception error: {}".format(e)) + file = file.replace("s://download","://master") + print("New url: {}".format(file)) + download_and_extract_7z(file, target)
\ No newline at end of file diff --git a/coin/dependencies.yaml b/coin/dependencies.yaml index c9df27bbb..4652d72b6 100644 --- a/coin/dependencies.yaml +++ b/coin/dependencies.yaml @@ -1,6 +1,6 @@ product_dependency: ../../qt/tqtc-qt5.git: - ref: "715f5bca3972b1841701f4ef10b7a582a1be2723" + ref: "36519195612b6596da28e19ea369c22c26ea4ba2" dependency_source: supermodule dependencies: [ "../../qt/qt3d", diff --git a/coin/instructions/common_environment.yaml b/coin/instructions/common_environment.yaml index 41ab0059c..cf391324e 100644 --- a/coin/instructions/common_environment.yaml +++ b/coin/instructions/common_environment.yaml @@ -119,6 +119,32 @@ instructions: variableName: LLVM_INSTALL_DIR variableValue: "{{.Env.LLVM_DYNAMIC_LIBS_100}}" disable_if: + condition: and + conditions: + - condition: property + property: target.arch + equals_value: X86_64-ARM64 # When target arch is universal binary, we can use the default libclang + - condition: property + property: host.os + equals_value: MacOS + - type: EnvironmentVariable + variableName: LLVM_INSTALL_DIR + variableValue: "/Users/qt/libclang-dynlibs-10.0-universal/libclang-dynlibs-10.0" + enable_if: + condition: and + conditions: + - condition: property + property: target.arch + equals_value: X86_64-ARM64 # When target arch is universal binary, we can use the default libclang + - condition: property + property: host.os + equals_value: MacOS + - type: PrependToEnvironmentVariable + variableName: PATH + variableValue: "/Library/Frameworks/Python.framework/Versions/3.9/bin:" + enable_if: condition: property - property: host.osVersion - equals_value: openSUSE_15_1 + property: host.os + equals_value: MacOS + + diff --git a/coin/instructions/execute_build_instructions.yaml b/coin/instructions/execute_build_instructions.yaml index e940e9250..ffd1ad5cc 100644 --- a/coin/instructions/execute_build_instructions.yaml +++ b/coin/instructions/execute_build_instructions.yaml @@ -1,13 +1,34 @@ type: Group instructions: - type: ExecuteCommand - command: "python -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=ALL" + command: "python -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch={{.Env.HOS_ARCH_COIN}} --targetArch={{.Env.TARGET_ARCH_COIN}} --phase=ALL" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 1200 enable_if: - condition: property - property: host.os - equals_value: MacOS + condition: and + conditions: + - condition: property + property: target.arch + equals_value: X86_64 + - condition: property + property: host.os + equals_value: MacOS + userMessageOnFailure: > + Failed to execute build instructions on osx + + - type: ExecuteCommand + command: "python3 -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=={{.Env.HOST_ARCH_COIN}} --targetArch=X86_64-ARM64 --phase=ALL" + maxTimeInSeconds: 14400 + maxTimeBetweenOutput: 1200 + enable_if: + condition: and + conditions: + - condition: property + property: target.arch + equals_value: X86_64-ARM64 + - condition: property + property: host.os + equals_value: MacOS userMessageOnFailure: > Failed to execute build instructions on osx - type: ExecuteCommand diff --git a/coin/instructions/execute_test_instructions.yaml b/coin/instructions/execute_test_instructions.yaml index f5dd7aa50..b30ec2b92 100644 --- a/coin/instructions/execute_test_instructions.yaml +++ b/coin/instructions/execute_test_instructions.yaml @@ -8,15 +8,35 @@ instructions: variableName: QTEST_ENVIRONMENT variableValue: "ci" - type: ExecuteCommand - command: "python -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}" + command: "python -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.TARGET_ARCH_COIN}}" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 1200 enable_if: - condition: property - property: host.os - equals_value: MacOS + condition: and + conditions: + - condition: property + property: target.arch + equals_value: X86_64 + - condition: property + property: host.os + equals_value: MacOS + userMessageOnFailure: > + Failed to execute test instructions on osx + - type: ExecuteCommand + command: "python -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch=X86_64-ARM64" + maxTimeInSeconds: 14400 + maxTimeBetweenOutput: 1200 + enable_if: + condition: and + conditions: + - condition: property + property: target.arch + equals_value: X86_64-ARM64 + - condition: property + property: host.os + equals_value: MacOS userMessageOnFailure: > - Failed to execute test instructions on osx + Failed to execute test instructions on osx - type: ExecuteCommand command: "python -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}" maxTimeInSeconds: 14400 diff --git a/coin/module_config.yaml b/coin/module_config.yaml index 99778cce6..ce6b58a7d 100644 --- a/coin/module_config.yaml +++ b/coin/module_config.yaml @@ -18,10 +18,20 @@ accept_configuration: not_contains_value: -no-gui - condition: property # Following configs are not supported property: target.osVersion - not_in_values: [OPENSUSE_13_01, QEMU, WebAssembly, Ubuntu_18_04, SLES_12, SLES_15, MacOS_10_15] + not_in_values: [openSUSE_15_1, OPENSUSE_13_01, QEMU, WebAssembly, Ubuntu_18_04, SLES_12, SLES_15, MacOS_10_15, MacOS_11_00, Windows_11_21H2] - condition: property # MibnGW and msvc2015 are not supported property: target.compiler not_in_values: [Mingw, MSVC2015] + + - condition: and + conditions: + - condition: property + property: target.osVersion + equals_value: Windows_11_21H2 + - condition: property + property: features + contains_value: Packaging + - condition: and conditions: - condition: property diff --git a/coin_build_instructions.py b/coin_build_instructions.py index 6a4d5dfd7..663633bf0 100644 --- a/coin_build_instructions.py +++ b/coin_build_instructions.py @@ -44,6 +44,7 @@ from build_scripts.utils import run_instruction from build_scripts.utils import rmtree from build_scripts.utils import get_python_dict from build_scripts.utils import get_ci_qmake_path +from build_scripts.utils import provisioning import os import datetime import calendar @@ -125,10 +126,18 @@ def call_setup(python_ver, phase): v_env = "virtualenv" run_instruction([v_env, "-p", _pExe, _env], "Failed to create virtualenv") # When the 'python_ver' variable is empty, we are using Python 2 - # Pip is always upgraded when CI template is provisioned, upgrading it in later phase may cause perm issue + try: + print("Upgrade pip") + run_instruction([env_python, "--m", "pip", "install", "--upgrade", "pip"]) + except Exception as e: + print("Failed to upgrade pip") + pass + run_instruction([env_pip, "install", "-r", "requirements.txt"], "Failed to install dependencies") if sys.platform == "win32": run_instruction([env_pip, "install", "numpy==1.19.3"], "Failed to install numpy 1.19.3") + elif os.environ.get("HOST_OSVERSION_COIN") == "macos_10_13" and python_ver == "3": + run_instruction([env_pip, "install", "numpy==1.19.4"], "Failed to install numpy") else: run_instruction([env_pip, "install", "numpy"], "Failed to install numpy") @@ -141,6 +150,12 @@ def call_setup(python_ver, phase): cmd += ["--build-tests", "--parallel=4", "--verbose-build"] + + if CI_TARGET_ARCH == "X86_64-ARM64": + cmd += ["--macos-arch='x86_64;arm64'"] + if CI_HOST_ARCH != "arm64": + cmd += ["--macos-deployment-target=10.14"] + if python_ver == "3": cmd += ["--limited-api=yes"] else: @@ -165,19 +180,28 @@ def call_setup(python_ver, phase): def run_build_instructions(phase): - # Uses default python, hopefully we have python2 installed on all hosts - # Skip building using Python 2 on Windows, because of different MSVC C runtimes (VS2008 vs VS2015+) - if CI_HOST_OS != "Windows": - call_setup("", phase) - # In case of packaging build, we have to build also python3 wheel - - if CI_RELEASE_CONF and CI_HOST_OS_VER not in ["RHEL_6_6"]: + if CI_TARGET_ARCH == "X86_64-ARM64": + # For universal wheels there will be only python3 wheel call_setup("3", phase) + else: + # Uses default python, hopefully we have python2 installed on all hosts + # Skip building using Python 2 on Windows, because of different MSVC C runtimes (VS2008 vs VS2015+) + if CI_HOST_OS != "Windows": + call_setup("2", phase) + # In case of packaging build, we have to build also python3 wheel + + if CI_RELEASE_CONF and CI_HOST_OS_VER not in ["RHEL_6_6"]: + call_setup("3", phase) + if __name__ == "__main__": # Remove some environment variables that impact cmake arch = '32' if CI_TARGET_ARCH and CI_TARGET_ARCH == 'X86' else '64' + # With 5.15.9 we are missing correct libclang so we need to install it for mac + # to create universal binaries. + if CI_HOST_OS == "MacOS" and CI_TARGET_ARCH == "X86_64-ARM64": + provisioning() expand_clang_variables(arch) for env_var in ['CC', 'CXX']: if os.environ.get(env_var): diff --git a/coin_test_instructions.py b/coin_test_instructions.py index 4ba5ac9ff..abb465223 100644 --- a/coin_test_instructions.py +++ b/coin_test_instructions.py @@ -43,6 +43,8 @@ from build_scripts.utils import get_qtci_virtualEnv from build_scripts.utils import run_instruction from build_scripts.utils import rmtree from build_scripts.utils import get_ci_qmake_path +from build_scripts.utils import provisioning + import os import site import sys @@ -85,6 +87,8 @@ def call_testrunner(python_ver, buildnro): run_instruction([env_pip, "install", "-r", "requirements.txt"], "Failed to install dependencies") if sys.platform == "win32": run_instruction([env_pip, "install", "numpy==1.19.3"], "Failed to install numpy 1.19.3") + elif os.environ.get("HOST_OSVERSION_COIN") == "macos_10_13" and python_ver == "3": + run_instruction([env_pip, "install", "numpy==1.19.4"], "Failed to install numpy") else: run_instruction([env_pip, "install", "numpy"], "Failed to install numpy") @@ -96,7 +100,7 @@ def call_testrunner(python_ver, buildnro): qmake_path = get_ci_qmake_path(CI_ENV_INSTALL_DIR, CI_HOST_OS) # Try to install built wheels, and build some buildable examples. - if CI_RELEASE_CONF: + if CI_RELEASE_CONF and CI_HOST_OS != "MacOS": wheel_tester_path = os.path.join("testing", "wheel_tester.py") cmd = [env_python, wheel_tester_path, qmake_path] run_instruction(cmd, "Error while running wheel_tester.py") @@ -104,6 +108,12 @@ def call_testrunner(python_ver, buildnro): def run_test_instructions(): # Remove some environment variables that impact cmake arch = '32' if CI_TARGET_ARCH and CI_TARGET_ARCH == 'X86' else '64' + + if CI_TARGET_ARCH == "X86_64-ARM64": + print("Install Libclang supporting universal binary") + provisioning() + else: + print("Using preinstalled libclang. While target arch was:" + str(CI_TARGET_ARCH)) expand_clang_variables(arch) for env_var in ['CC', 'CXX']: if os.environ.get(env_var): @@ -111,18 +121,18 @@ def run_test_instructions(): os.chdir(CI_ENV_AGENT_DIR) testRun = 0 - # We didn't build for Python 2 in win - if CI_HOST_OS != "Windows": + # In win machines, there are additional python versions to test with + if CI_HOST_OS == "Windows": + call_testrunner("3.6.1", str(testRun)) + call_testrunner("3.8.1", str(testRun)) + elif CI_HOST_OS == "MacOS" and CI_TARGET_ARCH=="X86_64-ARM64": + call_testrunner("3", str(testRun)) + else: call_testrunner("", str(testRun)) testRun =+ 1 - # We know that second build was with python3 - if CI_RELEASE_CONF: - # In win machines, there are additional python versions to test with - if CI_HOST_OS == "Windows": - call_testrunner("3.6.1", str(testRun)) - call_testrunner("3.8.1", str(testRun)) - else: - call_testrunner("3", str(testRun)) + call_testrunner("3", str(testRun)) if __name__ == "__main__": + print("HOST OS " + str(CI_HOST_OS)) + print("TARGET ARCH " + str(CI_TARGET_ARCH)) run_test_instructions() diff --git a/dist/changes-5.15.9 b/dist/changes-5.15.9 new file mode 100644 index 000000000..e31f9b206 --- /dev/null +++ b/dist/changes-5.15.9 @@ -0,0 +1,26 @@ +Qt for Python 5.15.9 is a bug-fix release. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qtforpython/ + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* PySide2 * +**************************************************************************** + + - [PYSIDE-1804] QByteArray::__msetitem__() was fixed for big endian + architectures + - [PYSIDE-1835] UNICODE conversion with Python3/Non-Limited API was fixed. + +**************************************************************************** +* Shiboken2 * +**************************************************************************** diff --git a/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml b/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml index 4f6d9086c..9e3b50cbc 100644 --- a/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml +++ b/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml @@ -57,6 +57,11 @@ <object-type name="QQuickFramebufferObject"> <object-type name="Renderer"/> + <modify-function signature="createRenderer()const"> + <modify-argument index="return"> + <define-ownership class="native" owner="c++"/> + </modify-argument> + </modify-function> </object-type> <object-type name="QQuickTextureFactory"/> diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml index 91458e313..6a6845f58 100644 --- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml @@ -548,6 +548,11 @@ <parent index="this" action="add"/> </modify-argument> </modify-function> + <modify-function signature="setPage(int,QWizardPage*)"> + <modify-argument index="2"> + <parent index="this" action="add"/> + </modify-argument> + </modify-function> <modify-function signature="setButton(QWizard::WizardButton,QAbstractButton*)"> <modify-argument index="2"> <parent index="this" action="add"/> diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index 78de3d5d5..8a9aae8f7 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -1065,9 +1065,10 @@ if (PyIndex_Check(_key)) { if (PyLong_Check(item) || PyInt_Check(item)) { #endif int overflow; - long ival = PyLong_AsLongAndOverflow(item, &overflow); - // Not suppose to bigger than 255 because only bytes, bytearray, QByteArray were accept - temp = QByteArray(reinterpret_cast<const char *>(&ival)); + const long ival = PyLong_AsLongAndOverflow(item, &overflow); + // Not supposed to be bigger than 255 because only bytes, + // bytearray, QByteArray were accepted + temp.append(char(ival)); } else { temp = %CONVERTTOCPP[QByteArray](item); } @@ -1751,7 +1752,25 @@ Py_END_ALLOW_THREADS // @snippet conversion-pylong-quintptr // @snippet conversion-pyunicode -#ifndef Py_LIMITED_API +#if defined(Py_LIMITED_API) + wchar_t *temp = PyUnicode_AsWideCharString(%in, NULL); + %out = QString::fromWCharArray(temp); + PyMem_Free(temp); +#elif defined(IS_PY3K) + void *data = PyUnicode_DATA(%in); + Py_ssize_t len = PyUnicode_GetLength(%in); + switch (PyUnicode_KIND(%in)) { + case PyUnicode_1BYTE_KIND: + %out = QString::fromLatin1(reinterpret_cast<const char *>(data)); + break; + case PyUnicode_2BYTE_KIND: + %out = QString::fromUtf16(reinterpret_cast<const char16_t *>(data), len); + break; + case PyUnicode_4BYTE_KIND: + %out = QString::fromUcs4(reinterpret_cast<const char32_t *>(data), len); + break; + } +#else // IS_PY3K Py_UNICODE *unicode = PyUnicode_AS_UNICODE(%in); # if defined(Py_UNICODE_WIDE) // cast as Py_UNICODE can be a different type @@ -1767,11 +1786,7 @@ Py_UNICODE *unicode = PyUnicode_AS_UNICODE(%in); %out = QString::fromUtf16(reinterpret_cast<const ushort *>(unicode), PepUnicode_GetLength(%in)); # endif // Qt 6 # endif -#else -wchar_t *temp = PyUnicode_AsWideCharString(%in, NULL); -%out = QString::fromWCharArray(temp); -PyMem_Free(temp); -#endif +#endif // !IS_PY3K // @snippet conversion-pyunicode // @snippet conversion-pystring diff --git a/sources/pyside2/PySide2/licensecomment.txt b/sources/pyside2/PySide2/licensecomment.txt index 9d271ba2a..05d291030 100644 --- a/sources/pyside2/PySide2/licensecomment.txt +++ b/sources/pyside2/PySide2/licensecomment.txt @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt for Python. diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp index 33b7c9c2e..73d6767dd 100644 --- a/sources/pyside2/libpyside/pysideproperty.cpp +++ b/sources/pyside2/libpyside/pysideproperty.cpp @@ -373,7 +373,7 @@ static PyObject *qPropertyDocGet(PyObject *self, void *) if (pData->fget != nullptr) { // PYSIDE-1019: Fetch the default `__doc__` from fget. We do it late. AutoDecRef get_doc(PyObject_GetAttr(pData->fget, PyMagicName::doc())); - if (!get_doc.isNull()) { + if (!get_doc.isNull() && get_doc.object() != Py_None) { pData->doc = String::toCString(get_doc); pData->getter_doc = true; if (Py_TYPE(self) == PySidePropertyTypeF()) diff --git a/sources/pyside2/pyside_version.py b/sources/pyside2/pyside_version.py index ba6e714b1..34caf4590 100644 --- a/sources/pyside2/pyside_version.py +++ b/sources/pyside2/pyside_version.py @@ -39,7 +39,7 @@ major_version = "5" minor_version = "15" -patch_version = "8" +patch_version = "9" # For example: "a", "b", "rc" # (which means "alpha", "beta", "release candidate"). diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp index d7ae45ae3..5a413ecaa 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp @@ -1918,7 +1918,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio for (const FunctionModification &mod : functionMods) { if (mod.exceptionHandling() != TypeSystem::ExceptionHandling::Unspecified) metaFunction->setExceptionHandlingModification(mod.exceptionHandling()); - else if (mod.allowThread() != TypeSystem::AllowThread::Unspecified) + if (mod.allowThread() != TypeSystem::AllowThread::Unspecified) metaFunction->setAllowThreadModification(mod.allowThread()); } diff --git a/sources/shiboken2/ApiExtractor/typesystem_enums.h b/sources/shiboken2/ApiExtractor/typesystem_enums.h index 0d7f279c4..3199c32ef 100644 --- a/sources/shiboken2/ApiExtractor/typesystem_enums.h +++ b/sources/shiboken2/ApiExtractor/typesystem_enums.h @@ -44,10 +44,10 @@ enum Language { }; enum class AllowThread { + Unspecified, Allow, Disallow, - Auto, - Unspecified + Auto }; enum Ownership { diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index b42ee2927..1ebe38fbc 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -3308,11 +3308,6 @@ void CppGenerator::writeNamedArgumentResolution(QTextStream &s, const AbstractMe else s << INDENT << "// fall through to handle extra keyword signals and properties\n"; } - s << INDENT << "} else {\n"; - { - Indentation indent(INDENT); - s << INDENT << "Py_DECREF(kwds_dup);\n"; - } s << INDENT << "}\n"; } s << INDENT << "}\n"; diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp index 7ac7fada2..afca7fa08 100644 --- a/sources/shiboken2/libshiboken/basewrapper.cpp +++ b/sources/shiboken2/libshiboken/basewrapper.cpp @@ -804,6 +804,7 @@ static PyObject *_setupNew(SbkObject *self, PyTypeObject *subtype) d->parentInfo = nullptr; d->referredObjects = nullptr; d->cppObjectCreated = 0; + d->isQAppSingleton = 0; self->ob_dict = nullptr; self->weakreflist = nullptr; self->d = d; diff --git a/sources/shiboken2/libshiboken/embed/signature_bootstrap.py b/sources/shiboken2/libshiboken/embed/signature_bootstrap.py index 902864267..b64131c15 100644 --- a/sources/shiboken2/libshiboken/embed/signature_bootstrap.py +++ b/sources/shiboken2/libshiboken/embed/signature_bootstrap.py @@ -62,6 +62,11 @@ recursion_trap = 0 # Python 2 is not able to import when the extension import is still active. # Phase 1 simply defines the functions, which will be used in Phase 2. +import sys +if sys.version_info[0] >= 3: + from importlib.machinery import ModuleSpec + + def bootstrap(): import sys import os @@ -204,31 +209,28 @@ class EmbeddableZipImporter(object): return None self.zfile = zip_file - self._path2mod = {_.filename : p2m(_.filename) for _ in zip_file.filelist} - self._mod2path = {_[1] : _[0] for _ in self._path2mod.items()} + self._mod2path = {p2m(_.filename) : _.filename for _ in zip_file.filelist} - def find_module(self, fullname, path): - return self if self._mod2path.get(fullname) else None + def find_spec(self, fullname, path, target=None): + path = self._mod2path.get(fullname) + return ModuleSpec(fullname, self) if path else None - def load_module(self, fullname): - import importlib - import sys + def create_module(self, spec): + return None - filename = self._mod2path.get(fullname) - if filename not in self._path2mod: - raise ImportError(fullname) - module_spec = importlib.machinery.ModuleSpec(fullname, None) - new_module = importlib.util.module_from_spec(module_spec) + def exec_module(self, module): + fullname = module.__spec__.name + filename = self._mod2path[fullname] with self.zfile.open(filename, "r") as f: # "rb" not for zipfile - exec(f.read(), new_module.__dict__) - new_module.__file__ = filename - new_module.__loader__ = self + codeob = compile(f.read(), filename, "exec") + exec(codeob, module.__dict__) + module.__file__ = filename + module.__loader__ = self if filename.endswith("/__init__.py"): - new_module.__path__ = [] - new_module.__package__ = fullname + module.__path__ = [] + module.__package__ = fullname else: - new_module.__package__ = fullname.rpartition('.')[0] - sys.modules[fullname] = new_module - return new_module + module.__package__ = fullname.rpartition('.')[0] + sys.modules[fullname] = module # eof diff --git a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp index 66df0fd94..fb28d883f 100644 --- a/sources/shiboken2/libshiboken/pep384impl.cpp +++ b/sources/shiboken2/libshiboken/pep384impl.cpp @@ -751,7 +751,7 @@ _Pep_PrivateMangle(PyObject *self, PyObject *name) #endif // IS_PY2 Shiboken::AutoDecRef privateobj(PyObject_GetAttr( reinterpret_cast<PyObject *>(Py_TYPE(self)), Shiboken::PyMagicName::name())); -#ifndef Py_LIMITED_API +#ifdef IS_PY2 return _Py_Mangle(privateobj, name); #else // PYSIDE-1436: _Py_Mangle is no longer exposed; implement it always. @@ -789,7 +789,7 @@ _Pep_PrivateMangle(PyObject *self, PyObject *name) if (amount > big_stack) free(resbuf); return result; -#endif // else Py_LIMITED_API +#endif // else IS_PY2 } /***************************************************************************** diff --git a/sources/shiboken2/shiboken_version.py b/sources/shiboken2/shiboken_version.py index ba6e714b1..34caf4590 100644 --- a/sources/shiboken2/shiboken_version.py +++ b/sources/shiboken2/shiboken_version.py @@ -39,7 +39,7 @@ major_version = "5" minor_version = "15" -patch_version = "8" +patch_version = "9" # For example: "a", "b", "rc" # (which means "alpha", "beta", "release candidate"). |