diff options
Diffstat (limited to 'sources')
23 files changed, 180 insertions, 51 deletions
diff --git a/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml b/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml index 5dc87a013..1e0219fd0 100644 --- a/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml +++ b/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml @@ -85,8 +85,20 @@ </object-type> <object-type name="QCategory3DAxis"/> <object-type name="QLogValue3DAxisFormatter"/> - <object-type name="QValue3DAxis"/> + <object-type name="QValue3DAxis"> + <modify-function signature="setFormatter(QValue3DAxisFormatter *)"> + <modify-argument index="1"> + <parent index="this" action="add"/> + </modify-argument> + </modify-function> + </object-type> <object-type name="QValue3DAxisFormatter"> + <modify-function signature="createNewInstance() const"> + <modify-argument index="return"> + <define-ownership class="native" owner="c++"/> + <define-ownership class="target" owner="default"/> + </modify-argument> + </modify-function> <modify-function signature="populateCopy(QtDataVisualization::QValue3DAxisFormatter&)const"> <modify-argument index="1"> <parent index="this" action="add"/> diff --git a/sources/pyside2/PySide2/QtGui/CMakeLists.txt b/sources/pyside2/PySide2/QtGui/CMakeLists.txt index 88d8be93f..38a0c1a50 100644 --- a/sources/pyside2/PySide2/QtGui/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtGui/CMakeLists.txt @@ -227,7 +227,7 @@ endif() list(FIND QtGui_enabled_features "opengles2" _opengles2Index) # ### fixme: For cmake >= 3.3: if(opengles2 IN_LIST QtGui_enabled_features) if(_opengles2Index GREATER -1) - list(APPEND QtGui_DROPPED_ENTRIES QOpenGLTimeMonitor QOpenGLTimerQuery) + list(APPEND QtGui_DROPPED_ENTRIES QOpenGLTimeMonitor QOpenGLTimerQuery QOpenGLVersionFunctionsFactory) message(STATUS "Qt${QT_MAJOR_VERSION}Gui: Dropping Desktop OpenGL classes (GLES2)") else() list(APPEND QtGui_SRC diff --git a/sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt b/sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt index 62ed669cc..208e76fac 100644 --- a/sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt @@ -11,7 +11,7 @@ set(QtOpenGLFunctions_SRC ${QtOpenGLFunctions_GEN_DIR}/qtopenglfunctions_module_ list(FIND QtOpenGLFunctions_enabled_features "opengles2" _opengles2Index) # ### fixme: For cmake >= 3.3: if(opengles2 IN_LIST QtOpenGLFunctions_enabled_features) if(_opengles2Index GREATER -1) - list(APPEND QtOpenGLFunctions_DROPPED_ENTRIES QOpenGLTimeMonitor QOpenGLTimerQuery) + list(APPEND QtOpenGLFunctions_DROPPED_ENTRIES QOpenGLTimeMonitor QOpenGLTimerQuery QOpenGLVersionFunctionsFactory) list(APPEND QtOpenGLFunctions_SRC ${QtOpenGLFunctions_GEN_DIR}/qopenglfunctions_es2_wrapper.cpp) message(STATUS "Qt${QT_MAJOR_VERSION}OpenGLFunctions: Dropping Desktop OpenGL classes (GLES2)") diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml index c20351723..bc71213ee 100644 --- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml @@ -2306,9 +2306,17 @@ </extra-includes> <modify-function signature="critical(QWidget*,const QString&,const QString&,QFlags<QMessageBox::StandardButton>,QMessageBox::StandardButton)" allow-thread="yes"/> + <modify-function signature="critical(QWidget*,const QString&,const QString&,QMessageBox::StandardButton,QMessageBox::StandardButton)" + allow-thread="yes"/> <modify-function signature="information(QWidget*,const QString&,const QString&,QFlags<QMessageBox::StandardButton>,QMessageBox::StandardButton)" allow-thread="yes"/> + <modify-function signature="information(QWidget*,const QString&,const QString&,QMessageBox::StandardButton,QMessageBox::StandardButton)" + allow-thread="yes"/> <modify-function signature="question(QWidget*,const QString&,const QString&,QFlags<QMessageBox::StandardButton>,QMessageBox::StandardButton)" allow-thread="yes"/> + <modify-function signature="question(QWidget*,const QString&,const QString&,QMessageBox::StandardButton,QMessageBox::StandardButton)" + allow-thread="yes"/> <modify-function signature="warning(QWidget*,const QString&,const QString&,QFlags<QMessageBox::StandardButton>,QMessageBox::StandardButton)" allow-thread="yes"/> + <modify-function signature="warning(QWidget*,const QString&,const QString&,QMessageBox::StandardButton,QMessageBox::StandardButton)" + allow-thread="yes"/> <modify-function signature="QMessageBox(const QString&,const QString&,QMessageBox::Icon,int,int,int,QWidget*,QFlags<Qt::WindowType>)" remove="all"/> <modify-function signature="critical(QWidget*,const QString&,const QString&,int,int,int)" remove="all"/> <modify-function signature="critical(QWidget*,const QString&,const QString&,const QString&,const QString&,const QString&,int,int)" remove="all"/> diff --git a/sources/pyside2/PySide2/support/generate_pyi.py b/sources/pyside2/PySide2/support/generate_pyi.py index 9eb84de7a..19565338f 100644 --- a/sources/pyside2/PySide2/support/generate_pyi.py +++ b/sources/pyside2/PySide2/support/generate_pyi.py @@ -147,10 +147,7 @@ class Formatter(Writer): self.print("from PySide2.support.signature.mapping import (") self.print(" Virtual, Missing, Invalid, Default, Instance)") self.print() - self.print("class Object(object): pass") - self.print() - self.print("import shiboken2 as Shiboken") - self.print("Shiboken.Object = Object") + self.print("from shiboken2 import Shiboken") self.print() # This line will be replaced by the missing imports postprocess. self.print("IMPORTS") @@ -222,7 +219,6 @@ def generate_pyi(import_name, outpath, options): outfile = io.StringIO() fmt = Formatter(outfile) fmt.print(LICENSE_TEXT.strip()) - need_imports = not USE_PEP563 if USE_PEP563: fmt.print("from __future__ import annotations") fmt.print() @@ -246,11 +242,10 @@ def generate_pyi(import_name, outpath, options): line = line.rstrip() # we remove the IMPORTS marker and insert imports if needed if line == "IMPORTS": - if need_imports: - for mod_name in find_imports(outfile.getvalue()): - imp = "PySide2." + mod_name - if imp != import_name: - wr.print("import " + imp) + for mod_name in find_imports(outfile.getvalue()): + imp = "PySide2." + mod_name + if imp != import_name: + wr.print("import " + imp) wr.print("import " + import_name) wr.print() wr.print() diff --git a/sources/pyside2/doc/gettingstarted-linux.rst b/sources/pyside2/doc/gettingstarted-linux.rst index 0474d457f..6ce2d1f86 100644 --- a/sources/pyside2/doc/gettingstarted-linux.rst +++ b/sources/pyside2/doc/gettingstarted-linux.rst @@ -49,11 +49,11 @@ If you don't have libclang already in your system, you can download from the Qt wget https://download.qt.io/development_releases/prebuilt/libclang/libclang-release_100-based-linux-Rhel7.6-gcc5.3-x86_64.7z -Extract the files, and leave it on any desired path, and then set these two required -environment variables:: +Extract the files, and leave it on any desired path, and set the environment +variable required:: 7z x libclang-release_100-based-linux-Rhel7.6-gcc5.3-x86_64.7z - export CLANG_INSTALL_DIR=$PWD/libclang + export LLVM_INSTALL_DIR=$PWD/libclang Getting PySide2 ~~~~~~~~~~~~~~~ diff --git a/sources/pyside2/doc/gettingstarted-macOS.rst b/sources/pyside2/doc/gettingstarted-macOS.rst index fd1bf89f8..b0208ff2c 100644 --- a/sources/pyside2/doc/gettingstarted-macOS.rst +++ b/sources/pyside2/doc/gettingstarted-macOS.rst @@ -50,11 +50,11 @@ If you don't have libclang already in your system, you can download from the Qt wget http://download.qt.io/development_releases/prebuilt/libclang/libclang-release_100-based-mac.7z -Extract the files, and leave it on any desired path, and then set these two required -environment variables:: +Extract the files, and leave it on any desired path, and set the environment +variable required:: 7z x libclang-release_100-based-mac.7z - export CLANG_INSTALL_DIR=$PWD/libclang + export LLVM_INSTALL_DIR=$PWD/libclang Getting PySide2 ~~~~~~~~~~~~~~~ diff --git a/sources/pyside2/doc/gettingstarted-windows.rst b/sources/pyside2/doc/gettingstarted-windows.rst index 069358e0f..442e6f7ed 100644 --- a/sources/pyside2/doc/gettingstarted-windows.rst +++ b/sources/pyside2/doc/gettingstarted-windows.rst @@ -59,8 +59,8 @@ Setting up CLANG If you don't have libclang already in your system, you can download from the Qt servers, e.g. ``libclang-release_100-based-windows-vs2019_64.7z``. -Extract the files, and leave it on any desired path, e.g ``c:\``, and then set these two required -environment variables:: +Extract the files, and leave it on any desired path, for example, ``c:``, +and set the environment variable required:: set LLVM_INSTALL_DIR=c:\libclang set PATH=C:\libclang\bin;%PATH% diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp index 73d6767dd..0d0957f55 100644 --- a/sources/pyside2/libpyside/pysideproperty.cpp +++ b/sources/pyside2/libpyside/pysideproperty.cpp @@ -104,6 +104,7 @@ static PyType_Slot PySidePropertyType_slots[] = { {Py_tp_init, (void *)qpropertyTpInit}, {Py_tp_new, (void *)qpropertyTpNew}, {Py_tp_getset, PySidePropertyType_getset}, + {Py_tp_del, reinterpret_cast<void *>(PyObject_GC_Del)}, {0, 0} }; // Dotted modulename is crucial for SbkType_FromSpec to work. Is this name right? @@ -249,6 +250,7 @@ static void qpropertyDeAlloc(PyObject *self) // This was not needed before Python 3.8 (Python issue 35810) Py_DECREF(Py_TYPE(self)); } + PyObject_GC_UnTrack(self); Py_TYPE(self)->tp_free(self); } diff --git a/sources/pyside2/libpyside/pysideqflags.cpp b/sources/pyside2/libpyside/pysideqflags.cpp index 8b224f2c8..1f64b089d 100644 --- a/sources/pyside2/libpyside/pysideqflags.cpp +++ b/sources/pyside2/libpyside/pysideqflags.cpp @@ -191,8 +191,9 @@ namespace QFlags SbkNewQFlagsType_slots[idx].pfunc = numberMethods[idx].pfunc; } newspec.slots = SbkNewQFlagsType_spec.slots; - PyTypeObject *type = (PyTypeObject *)SbkType_FromSpec(&newspec); - Py_TYPE(type) = &PyType_Type; + auto *obj = SbkType_FromSpec(&newspec); + auto *type = reinterpret_cast<PyTypeObject *>(obj); + obj->ob_type = &PyType_Type; PySideQFlagsType *flagsType = reinterpret_cast<PySideQFlagsType *>(type); PepType_PFTP(flagsType)->converterPtr = &PepType_PFTP(flagsType)->converter; diff --git a/sources/pyside2/libpyside/pysidesignal.cpp b/sources/pyside2/libpyside/pysidesignal.cpp index b5069a00a..607ce163c 100644 --- a/sources/pyside2/libpyside/pysidesignal.cpp +++ b/sources/pyside2/libpyside/pysidesignal.cpp @@ -160,9 +160,10 @@ PyTypeObject *PySideSignalTypeF(void) { static PyTypeObject *type = nullptr; if (!type) { - type = reinterpret_cast<PyTypeObject *>(SbkType_FromSpec(&PySideSignalType_spec)); + auto *obj = SbkType_FromSpec(&PySideSignalType_spec); + type = reinterpret_cast<PyTypeObject *>(obj); PyTypeObject *hold = Py_TYPE(type); - Py_TYPE(type) = PySideMetaSignalTypeF(); + obj->ob_type = PySideMetaSignalTypeF(); Py_INCREF(Py_TYPE(type)); Py_DECREF(hold); } diff --git a/sources/pyside2/libpyside/pysideweakref.cpp b/sources/pyside2/libpyside/pysideweakref.cpp index cd90634bd..707df98f5 100644 --- a/sources/pyside2/libpyside/pysideweakref.cpp +++ b/sources/pyside2/libpyside/pysideweakref.cpp @@ -88,10 +88,11 @@ PyObject *create(PyObject *obj, PySideWeakRefFunction func, void *userData) if (obj == Py_None) return 0; - if (Py_TYPE(PySideCallableObjectTypeF()) == 0) - { - Py_TYPE(PySideCallableObjectTypeF()) = &PyType_Type; - PyType_Ready(PySideCallableObjectTypeF()); + auto *callableObject_Type = PySideCallableObjectTypeF(); + auto *callableObject_PyObject = reinterpret_cast<PyObject *>(callableObject_Type); + if (callableObject_PyObject->ob_type == nullptr) { + callableObject_PyObject->ob_type = &PyType_Type; + PyType_Ready(callableObject_Type); } PyTypeObject *type = PySideCallableObjectTypeF(); diff --git a/sources/pyside2/pyside_version.py b/sources/pyside2/pyside_version.py index 80dd16ae0..88792a380 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 = "10" +patch_version = "11" # For example: "a", "b", "rc" # (which means "alpha", "beta", "release candidate"). diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp index b73670909..ebe3b995a 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp +++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp @@ -784,18 +784,22 @@ static bool cStringStartsWith(const char *str, const QByteArray &prefix) return std::strncmp(prefix.constData(), str, int(prefix.size())) == 0; } +#ifdef Q_OS_UNIX +static bool cStringContains(const char *str, const char *prefix) +{ + return std::strstr(str, prefix) != nullptr; +} +#endif + bool BuilderPrivate::visitHeader(const char *cFileName) const { // Resolve OpenGL typedefs although the header is considered a system header. const char *baseName = cBaseName(cFileName); if (cCompareFileName(baseName, "gl.h")) return true; -#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS) - if (cStringStartsWith(cFileName, "/usr/include/stdint.h")) - return true; -#endif #ifdef Q_OS_LINUX - if (cStringStartsWith(cFileName, "/usr/include/stdlib.h") + if (cStringStartsWith(cFileName, "/usr/include/stdint.h") + || cStringStartsWith(cFileName, "/usr/include/stdlib.h") || cStringStartsWith(cFileName, "/usr/include/sys/types.h")) { return true; } @@ -804,9 +808,9 @@ bool BuilderPrivate::visitHeader(const char *cFileName) const // Parse the following system headers to get the correct typdefs for types like // int32_t, which are used in the macOS implementation of OpenGL framework. if (cCompareFileName(baseName, "gltypes.h") - || cStringStartsWith(cFileName, "/usr/include/_types") - || cStringStartsWith(cFileName, "/usr/include/_types") - || cStringStartsWith(cFileName, "/usr/include/sys/_types")) { + || cStringContains(cFileName, "/usr/include/stdint.h") + || cStringContains(cFileName, "/usr/include/_types") + || cStringContains(cFileName, "/usr/include/sys/_types")) { return true; } #endif // Q_OS_MACOS diff --git a/sources/shiboken2/doc/typesystem_specifying_types.rst b/sources/shiboken2/doc/typesystem_specifying_types.rst index 221519541..e43b878ba 100644 --- a/sources/shiboken2/doc/typesystem_specifying_types.rst +++ b/sources/shiboken2/doc/typesystem_specifying_types.rst @@ -81,14 +81,17 @@ rejection <typesystem> <rejection class="..." function-name="..." + argument-type="..." field-name="..." /> </typesystem> - The **class** attribute is the C++ class name of the class to reject. Use the - *optional* **function-name** or **field-name** attributes to reject a particular - function or field. Note that the **field-name** and **function-name** cannot - be specified at the same time. To remove all occurrences of a given field or - function, set the class attribute to \*. + The **class** attribute is the C++ class name of the class to reject. Use + the *optional* **function-name**, **argument-type**, or **field-name** + attributes to reject a particular function, function with arguments of a + particular type, or a field. Note that the **field-name** and + **function-name**/**argument-type** cannot be specified at the same time. + To remove all occurrences of a given field or function, set the class + attribute to \*. .. _primitive-type: diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp index afca7fa08..1919f2825 100644 --- a/sources/shiboken2/libshiboken/basewrapper.cpp +++ b/sources/shiboken2/libshiboken/basewrapper.cpp @@ -376,8 +376,9 @@ SbkObjectType *SbkObject_TypeF(void) { static PyTypeObject *type = nullptr; if (!type) { - type = reinterpret_cast<PyTypeObject *>(SbkType_FromSpec(&SbkObject_Type_spec)); - Py_TYPE(type) = SbkObjectType_TypeF(); + auto *obj = SbkType_FromSpec(&SbkObject_Type_spec); + type = reinterpret_cast<PyTypeObject *>(obj); + obj->ob_type = SbkObjectType_TypeF(); Py_INCREF(Py_TYPE(type)); type->tp_weaklistoffset = offsetof(SbkObject, weakreflist); type->tp_dictoffset = offsetof(SbkObject, ob_dict); @@ -521,7 +522,11 @@ void SbkObjectTypeDealloc(PyObject *pyObj) PyObject_GC_UnTrack(pyObj); #ifndef Py_LIMITED_API +# if PY_VERSION_HEX >= 0x030A0000 + Py_TRASHCAN_BEGIN(pyObj, 1); +# else Py_TRASHCAN_SAFE_BEGIN(pyObj); +# endif #endif if (sotp) { if (sotp->user_data && sotp->d_func) { @@ -536,7 +541,11 @@ void SbkObjectTypeDealloc(PyObject *pyObj) sotp = nullptr; } #ifndef Py_LIMITED_API +# if PY_VERSION_HEX >= 0x030A0000 + Py_TRASHCAN_END; +# else Py_TRASHCAN_SAFE_END(pyObj); +# endif #endif if (PepRuntime_38_flag) { // PYSIDE-939: Handling references correctly. @@ -1161,7 +1170,7 @@ introduceWrapperType(PyObject *enclosingObject, typeSpec->slots[0].pfunc = reinterpret_cast<void *>(baseType ? baseType : SbkObject_TypeF()); PyObject *heaptype = SbkType_FromSpecWithBases(typeSpec, baseTypes); - Py_TYPE(heaptype) = SbkObjectType_TypeF(); + heaptype->ob_type = SbkObjectType_TypeF(); Py_INCREF(Py_TYPE(heaptype)); auto *type = reinterpret_cast<SbkObjectType *>(heaptype); #if PY_VERSION_HEX < 0x03000000 @@ -1526,6 +1535,7 @@ bool setCppPointer(SbkObject *sbkObj, PyTypeObject *desiredType, void *cptr) bool isValid(PyObject *pyObj) { if (!pyObj || pyObj == Py_None + || PyType_Check(pyObj) != 0 || Py_TYPE(Py_TYPE(pyObj)) != SbkObjectType_TypeF()) { return true; } diff --git a/sources/shiboken2/libshiboken/sbkenum.cpp b/sources/shiboken2/libshiboken/sbkenum.cpp index 7dc73dfbc..38e702296 100644 --- a/sources/shiboken2/libshiboken/sbkenum.cpp +++ b/sources/shiboken2/libshiboken/sbkenum.cpp @@ -330,13 +330,21 @@ void SbkEnumTypeDealloc(PyObject *pyObj) PyObject_GC_UnTrack(pyObj); #ifndef Py_LIMITED_API +# if PY_VERSION_HEX >= 0x030A0000 + Py_TRASHCAN_BEGIN(pyObj, 1); +# else Py_TRASHCAN_SAFE_BEGIN(pyObj); +# endif #endif if (PepType_SETP(sbkType)->converter) { Shiboken::Conversions::deleteConverter(PepType_SETP(sbkType)->converter); } #ifndef Py_LIMITED_API +# if PY_VERSION_HEX >= 0x030A0000 + Py_TRASHCAN_END; +# else Py_TRASHCAN_SAFE_END(pyObj); +# endif #endif if (PepRuntime_38_flag) { // PYSIDE-939: Handling references correctly. @@ -752,9 +760,10 @@ newTypeWithName(const char *name, static auto basetype = SbkEnum_TypeF(); Py_INCREF(basetype); PyTuple_SetItem(bases, 0, reinterpret_cast<PyObject *>(basetype)); - auto *type = reinterpret_cast<PyTypeObject *>(SbkType_FromSpecWithBases(&newspec, bases)); + auto *obj = SbkType_FromSpecWithBases(&newspec, bases); + auto *type = reinterpret_cast<PyTypeObject *>(obj); PyErr_Print(); - Py_TYPE(type) = SbkEnumType_TypeF(); + obj->ob_type = SbkEnumType_TypeF(); auto *enumType = reinterpret_cast<SbkEnumType *>(type); PepType_SETP(enumType)->cppName = cppName; diff --git a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp index 996968fa1..cc25b349d 100644 --- a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp +++ b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp @@ -116,8 +116,13 @@ std::ostream &operator<<(std::ostream &str, PyArrayObject *o) str << " NPY_ARRAY_NOTSWAPPED"; if ((flags & NPY_ARRAY_WRITEABLE) != 0) str << " NPY_ARRAY_WRITEABLE"; +#if NPY_VERSION >= 0x00000010 // NPY_1_23_API_VERSION + if ((flags & NPY_ARRAY_WRITEBACKIFCOPY) != 0) + str << " NPY_ARRAY_WRITEBACKIFCOPY"; +#else if ((flags & NPY_ARRAY_UPDATEIFCOPY) != 0) str << " NPY_ARRAY_UPDATEIFCOPY"; +#endif } else { str << '0'; } diff --git a/sources/shiboken2/libshiboken/sbkstring.cpp b/sources/shiboken2/libshiboken/sbkstring.cpp index 077fb531b..0f83aeef0 100644 --- a/sources/shiboken2/libshiboken/sbkstring.cpp +++ b/sources/shiboken2/libshiboken/sbkstring.cpp @@ -41,8 +41,14 @@ #include "sbkstaticstrings_p.h" #include "autodecref.h" -#include <vector> -#include <unordered_set> +#if PY_VERSION_HEX >= 0x03000000 +# define USE_INTERN_STRINGS +#endif + +#ifndef USE_INTERN_STRINGS +# include <vector> +# include <unordered_set> +#endif namespace Shiboken { @@ -233,6 +239,13 @@ Py_ssize_t len(PyObject *str) // PyObject *attr = PyObject_GetAttr(obj, name()); // +#ifdef USE_INTERN_STRINGS +PyObject *createStaticString(const char *str) +{ + return PyUnicode_InternFromString(str); +} +#else + using StaticStrings = std::unordered_set<PyObject *>; static void finalizeStaticStrings(); // forward @@ -283,6 +296,8 @@ PyObject *createStaticString(const char *str) return result; } +#endif // !USE_INTERN_STRINGS + /////////////////////////////////////////////////////////////////////// // // PYSIDE-1019: Helper function for snake_case vs. camelCase names diff --git a/sources/shiboken2/shiboken_version.py b/sources/shiboken2/shiboken_version.py index 80dd16ae0..88792a380 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 = "10" +patch_version = "11" # For example: "a", "b", "rc" # (which means "alpha", "beta", "release candidate"). diff --git a/sources/shiboken2/shibokenmodule/CMakeLists.txt b/sources/shiboken2/shibokenmodule/CMakeLists.txt index 9b2b58528..c861caf29 100644 --- a/sources/shiboken2/shibokenmodule/CMakeLists.txt +++ b/sources/shiboken2/shibokenmodule/CMakeLists.txt @@ -41,6 +41,14 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_config.py" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in" "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" @ONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Shiboken.pyi" + "${CMAKE_CURRENT_BINARY_DIR}/Shiboken.pyi" @ONLY) +# typing support for mypy +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/py.typed.in" + "${CMAKE_CURRENT_BINARY_DIR}/py.typed" @ONLY) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Shiboken.pyi" + "${CMAKE_CURRENT_BINARY_DIR}/py.typed" + DESTINATION "${PYTHON_SITE_PACKAGES}/shiboken2") # Variable from enclosing scope. foreach(item IN LISTS shiboken_python_files) diff --git a/sources/shiboken2/shibokenmodule/Shiboken.pyi b/sources/shiboken2/shibokenmodule/Shiboken.pyi new file mode 100644 index 000000000..93556ba40 --- /dev/null +++ b/sources/shiboken2/shibokenmodule/Shiboken.pyi @@ -0,0 +1,54 @@ +############################################################################# +## +## Copyright (C) 2022 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of Qt for Python. +## +## $QT_BEGIN_LICENSE:COMM$ +## +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## $QT_END_LICENSE$ +## +############################################################################# + +from __future__ import annotations + +""" +This file contains the exact signatures for all functions in module +Shiboken, except for defaults which are replaced by "...". +""" + +# Module `Shiboken` + +from shiboken2 import Shiboken + + +class Object(object): + + def __init__(self) -> None: ... + + +class VoidPtr(object): ... + + +def _unpickle_enum(arg__1: object, arg__2: object) -> object: ... +def createdByPython(arg__1: Shiboken.Object) -> bool: ... +def delete(arg__1: Shiboken.Object) -> None: ... +def dump(arg__1: object) -> str: ... +def getAllValidWrappers() -> Shiboken.Object: ... +def getCppPointer(arg__1: Shiboken.Object) -> Shiboken.Object: ... +def invalidate(arg__1: Shiboken.Object) -> None: ... +def isValid(arg__1: object) -> bool: ... +def ownedByPython(arg__1: Shiboken.Object) -> bool: ... +def wrapInstance(arg__1: int, arg__2: type) -> Shiboken.Object: ... + + +# eof diff --git a/sources/shiboken2/shibokenmodule/py.typed.in b/sources/shiboken2/shibokenmodule/py.typed.in new file mode 100644 index 000000000..0e76a07dc --- /dev/null +++ b/sources/shiboken2/shibokenmodule/py.typed.in @@ -0,0 +1 @@ +# this is a marker file for mypy |