diff options
Diffstat (limited to 'sources')
-rw-r--r-- | sources/pyside2/PySide2/QtQuick/typesystem_quick.xml | 5 | ||||
-rw-r--r-- | sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml | 5 | ||||
-rw-r--r-- | sources/pyside2/PySide2/glue/qtcore.cpp | 33 | ||||
-rw-r--r-- | sources/pyside2/PySide2/licensecomment.txt | 2 | ||||
-rw-r--r-- | sources/pyside2/libpyside/pysideproperty.cpp | 2 | ||||
-rw-r--r-- | sources/pyside2/pyside_version.py | 2 | ||||
-rw-r--r-- | sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp | 2 | ||||
-rw-r--r-- | sources/shiboken2/ApiExtractor/typesystem_enums.h | 4 | ||||
-rw-r--r-- | sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 5 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/basewrapper.cpp | 1 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/embed/signature_bootstrap.py | 42 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/pep384impl.cpp | 4 | ||||
-rw-r--r-- | sources/shiboken2/shiboken_version.py | 2 |
13 files changed, 66 insertions, 43 deletions
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"). |