aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6
Commit message (Collapse)AuthorAgeFilesLines
* shiboken6/test: Fix warnings about implicitly generated assignment operatorsFriedemann Kleint2022-09-2316-56/+58
| | | | | | | | | | | | | | Fix warnings like: warning: implicitly-declared constexpr Pen& Pen::operator=(const Pen&) is deprecated [-Wdeprecated-copy] by removing definitions of copy constructors/assignment operators which are equivalent to the default generated ones or spell out the special methods were needed. Change-Id: Ie7cb335707f8bdd297b0ceea969909bc809016d7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit f419206841764323c244bf91051b2878451c17b6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Documentation/patch_qhp.py: Strip the module from the indexFriedemann Kleint2022-09-211-0/+16
| | | | | | | | | | | | | | This makes the index actually useable since it is then possible to find a class by starting to type the name. The downside is that there is a conflict with the Qt names if the C++ documentation is installed, too. Change-Id: I231a90025b2777fe8ff23fcc9dd669722dcd922e Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit fa38984e53a7a325fd317822f75551379763b810) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Documentation/patch_qhp.py: Brush up scriptFriedemann Kleint2022-09-132-26/+39
| | | | | | | | | | | | - Fix flake8 warnings - Warn about errors - Move line processing into a function for further extension - Make file a positional argument Change-Id: Ice191b8b78ff3a151581066ae0fc493ecb54fb64 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 3b31a65a76de7f29f32c27201b35f5f3c17d14e5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* shiboken6: Fix a crash caused by invalid return types of added functionsFriedemann Kleint2022-09-061-1/+1
| | | | | | | | | | Pass up the parse error. Task-number: PYSIDE-2046 Change-Id: I5c32b056887ac9b4b5229457e5416fa16d4b1818 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit b42c3339158c4c677e16614e698db30a3643122f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* shiboken6: Use the full path of libdir in pkg-config fileZhu Zihao2022-09-021-1/+1
| | | | | | | | | | | | "libdir" in shiboken6.pc is the relative path to the install prefix. Fix it to the full path of directory. Fixes: PYSIDE-2040 Change-Id: I5caa54813e2104b7ebd9163ba2c5da781ac28919 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 855aaa252bdba645af19a11ea887befe06febacd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Modernize Shiboken.getAllValidWrappers()Friedemann Kleint2022-09-021-8/+7
| | | | | | | | | | Task-number: PYSIDE-2046 Change-Id: I09bea4ba6a9793cc576f3a3c8ef44df021744a3a Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 3911525f0b8ee1c8b301ef794cff4bf24e9f68f1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix stubs of shiboken6.ShibokenFriedemann Kleint2022-09-022-11/+11
| | | | | | | | | Fixes: PYSIDE-2046 Change-Id: I6a888d1f1f8dff25d5fc7f40131504d93c79be62 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit fc9b08123a1f2c3a9d1d6def83dd4d4599646c34) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PyEnum: Finish the flexible Enum/Flag assignment and correctChristian Tismer2022-09-024-20/+16
| | | | | | | | | | | | | | | | | | The former fixed coupling between flags and the Enum/Flag decision is no longer correct, because there are rare cases which deviate heavily from the default. One example is Qt.Modifier: This class is equivalent to Qt.KeyboardModifier, which is a Python Flag type. This patch implements the full flexibility of redefining enum and flag and corrects the Qt.Modifier case. Task-number: PYSIDE-1735 Change-Id: I7947e722f72b4d7b821bce57586e1793a1089606 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit edbee6b65aeafc0fb9a5cdb8d53e04e15a94edbe) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PyEnum: Simplify code generator because of full forgivenessChristian Tismer2022-09-022-22/+2
| | | | | | | | | | | | | | | | | | | | | | PyEnum needed extra signature handling in the parser.py file and the abstractmetatype.cpp file because we needed to decide at runtime what names are to be generated. With the full forgiveness mode, all special handling is still implemented, but the old versions of the enum representation can also always be used. The unexpected funny side effect is that we now can remove all special handling that has been implemented for these cases. The way how things are written is no longer relevant, although the new version is still the only one advertized. Change-Id: I76efc8ffc646d3a04d974d6776a1c9c2b5ffec70 Task-number: PYSIDE-1735 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 5419080e948c89d4f271d7d4a9bf980f647d53f5) Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* doc: use more processes for sphinx-buildCristián Maureira-Fredes2022-09-011-1/+1
| | | | | | | | | | | Adding the option '-j auto' to the calls we have for sphinx-build, speeding up the documentation generation process. Change-Id: Ie676d305e283fa217a90f3de64f96978ce6b3af0 Task-number: PYSIDE-1106 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit ddbf71586ac56b623c6467285b2b965f377d4752) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* shiboken6: Trim white space of default expressionsFriedemann Kleint2022-08-181-2/+5
| | | | | | | | | | Remove Windows carriage return characters as observed in the signature of QWebEngineView::printToPdf(). Change-Id: I29db24d7407436f9f579684fb6dbce3c1c4cbf7b Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit db143665ff9df2e07cc4d072e88cfe071666c63f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* signature: Update, cleanup and install signature testChristian Tismer2022-08-182-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | The signature tests were disabled for a long time. Meanwhile, a number of unresolved values have piled up. The reason was partially a weird mixture of intents that made it unpractical to run the full tests on every platform. Mamely, macOS was quite unclear about which signatures have to exist and which don't. This overhaul does the following: * The various Shiboken modules were removed from the tested signatures * A pure test is added that only checks for no offending lines As effect, signatures are tested unconditionally without any other conditions. The other tests remain disabled. Task-number: PYSIDE-510 Change-Id: Id9e65ed7324a795966f460e13dd95fd5cebcca6a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit bd3e8afdb06c8614164e4ed1f195a8618c1d586d)
* PyEnum: Enable the type definition to override all enum typesChristian Tismer2022-08-153-3/+8
| | | | | | | | | | | | | | | | | | | | The new enum support in XML knew IntEnum and IntFlag, only. After we recognized that there exist three cases that should be IntFlag, although there is no according "flags" C++ definition and adding this definition crashes, it became clear that we must allow to override IntEnum by IntFlag, just for Python. But the existence of such cases may be not restricted to IntEnum, it can also occur with normal enums. This patch prepares such an override. It must be still checked if there are such cases at all. Task-number: PYSIDE-1735 Change-Id: I4af1c3153c84f88fbef6ac36e421c47dfb5429a9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 3d8ade9b5bd6f8114bd52b33d454bfc141684d54) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PyEnum: Accelerate item accessChristian Tismer2022-08-151-7/+11
| | | | | | | | | | | | | | | | With the transition to Python 3.11, access to enum items has become slower by the replacement of direct item access by Python properties, involving unnecessarily the use of Python code. When we are in charge of Enum item access, we circumvent the slower property access by using the internal mapping directly. Task-number: PYSIDE-1735 Change-Id: Iabe045be09df847d9587e9d3f6913e9610f5695e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 01e048763a372677c358172a66232f15b09a1021) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PyEnum: Define a fixed list of Int(Enum|Flag) decisionsChristian Tismer2022-08-156-26/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | | This was "PyEnum: Write a default Int decisor for Enum and Flag". Historically, C++ enums were all compatible with int. The new Python enums are more diverse here. There are the basic types Enum/IntEnum and Flag/IntFlag. We have tried a lot to come up with a sensible default heuristic computed from the data. In the end, this was reverted and replaced by a fixed list that was collected from similar implementations. By the move away from Int inheritance, a few classes needed extra support. Python 3.11.0b5 also required the Flag creation parameter "boundary=KEEP". It is not clear if this is correct, yet. [ChangeLog][shiboken6] Most former IntEnum/IntFlag are replaced by pure Enum/Flag classes in a generally compatible way to other implementations. Change-Id: I1dbe7b0556a3375df89eb40e9d9f495f14bf42b1 Task-number: PYSIDE-1735 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 0f5dcb03eb258280acd10a0f4f2889301a9ef365)
* PyEnum: Fix QKeySequence to stay correct when switching IntEnum to EnumChristian Tismer2022-08-152-0/+9
| | | | | | | | | | | | | | | | | | | | | | | Most PyEnum types will no longer be compatible with int, when we change from IntEnum to Enum. This has a number of consequences and leads to improvements in type representations. The repr of QKeySequence was actually wrong and misleading, see the test qkeysequence_test.py . We change the repr and the indexing to return QKeyCombination like our competitor does since a long time. [ChangeLog][PySide6] QKeySequence returns now QKeyCombination instances when indexed and the new PyEnums are used. Change-Id: Idaaeb44ca3b6103b3e0416eaeb691ad954745f73 Task-number: PYSIDE-1735 Fixes: PYSIDE-2021 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 06bc40580c5f170e903d58e5e1fe5793be749e3c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* shiboken6: Remove Python code snippet markersFriedemann Kleint2022-08-111-3/+6
| | | | | | | | | | | Task-number: PYSIDE-1984 Task-number: PYSIDE-1952 Change-Id: I2e74b9c3d26c8d9fb60480c052189630ff54eded Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit df9c852d6cd6a3aff5d93ff17fcee38dc9e7088b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add a typesystem XML attribute for Python enum typesFriedemann Kleint2022-08-105-0/+46
| | | | | | | | | This is preparing the PyEnum completion of different Enum types. Task-number: PYSIDE-1735 Change-Id: I917bd62eae785b486302092c33843efceecf0568 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 1a71e6f87d238c72f8d2fadf976310378ae78b3d)
* Shiboken: use the Python 3.11 buffer interface for Limited APIChristian Tismer2022-07-192-5/+6
| | | | | | | | | | | | | | | | | | | | | Because the stable API includes now the bufferprocs, we add a warning to remove the special handling when the lowest version is 3.11 . Unfortunately, I see no other way to use the new buffer interface, because things must work with every Python runtime. But that also does no harm, since this is now in the stable API. And of course, we can remove the boring version check :) Also, an old shiboken error workaround could be removed. XXX No, the shiboken error still exists in RHEL Change-Id: I2fae8cabb2cf116a7365b9cf45618da5238c2ea7 Task-number: PYSIDE-1960 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit a3c1a50eb1577caf3715c47b00ca26312d235a80) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PyEnum: Increase compatibility by allowing defaults etc., refinementChristian Tismer2022-07-193-20/+38
| | | | | | | | | | | | | | | | | | | The change has been tested with Python 3.6 to 3.11.0b4 . The enum_310.py warning triggers now only when on 3.11.0 final. The enumFlagInfo empty check was simplified by removing empty structures. The code introspection was optimized version-specific for Python 3.9 and Python 3.11 where optimizations were introduced. Task-number: PYSIDE-1735 Change-Id: Ic5e25fd4edae0ab92aad291a8067c9dcccd5acb8 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 615d6a820137b31f03295e884f58cd46aadf5032) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PyEnum: Simplify the test-cases with the new forgiveness modeChristian Tismer2022-07-143-22/+14
| | | | | | | | | | | | | | | | | | | | | | | With the new forgiveness, all the "normal" uses of old enums are working with the new enums, too. What does not work are range violations and inheritance of enums from other enums. Also, the implemented trick does not work for enums which do not belong to a class. The induced bugs are easy to find, because they should normally break at import time. [ChangeLog][PySide6] The new forgiveness mode of Python enums allows to use old enum code, most of the time. Much changed test code was reverted. Change-Id: I9c081831309f1b2358fe86e6107b0f4d78fd48cf Task-number: PYSIDE-1735 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 0a3f69537d5901d626077c0a8e6486f33ebf88af) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PyEnum: Increase compatibility by allowing defaults and old flag namesChristian Tismer2022-07-145-8/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch supports to write Qt.Alignment() instead of Qt.AlignmentFlag(0) Also supported is Qt.AlignmentFlag() which is mapped to Qt.AlignmentFlag(0) This trickery was quite involved since the Python opcodes needed to be analyzed if we have a parameterless call. Only in that case, we insert a partial object which supplies the missing value=0 default. Changing the implementation of PyEnum was not desired because this is highly complicated, not portable and even not possible. The change has been tested with Python 3.6 to 3.11.0b3 . [ChangeLog][shiboken6] The new Python enums are made as compatible to the old ones as possible. It is again allowed to use Qt.Alignment() instead of Qt.AlignmentFlag(0), and a default of 0 is always allowed. Change-Id: If6a93f8210ff6cae4e38251420e1ad5fffbe42cb Task-number: PYSIDE-1735 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit f92b7dcac9537fb091dc15d3ee218f1984d8abef) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PyEnum: make forgiving duplicates work with Python 3.11Christian Tismer2022-07-143-10/+16
| | | | | | | | | | | | | | | | | | | | There was a silent change in PyEnums that turns Enum attributes into properties. This does not harm the Python interface but needed some change in the duplication emulation. Furthermore, new internal enums are created with an underscore name. The meta class was changed from EnumMeta to EnumType. [ChangeLog][shiboken6] The new Python Enums are now compatible with Python 3.11 Change-Id: I3b1ab63dc5eed15a75ebd0f42dddf4001f640c00 Task-number: PYSIDE-1735 Fixes: PYSIDE-1960 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit da2cf031521815a9559ca784beadb70c7a2852d9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Shiboken: Rewrite the signature initializationChristian Tismer2022-07-0711-104/+68
| | | | | | | | | | | | | | | | [ChangeLog][shiboken6] The initialization of the signature module was moved into Shiboken and rearranged. This was necessary for the new backward-compatible PyEnum module. This change makes even sense if the PyEnum forgiveness should not work in 3.11 because it is a real cleanup. Change-Id: I5de54584154fb43648617adcac823f42049be57b Task-number: PYSIDE-1735 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit dc058bddb1f1089c007721c9301e174f3f7a7887) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Shiboken: Move the shibokensupport initialization into the moduleChristian Tismer2022-07-074-11/+16
| | | | | | | | | | | | | | | | Importing shibokensupport is now possible inside the Shiboken import. That is a prerequisite to re-order the signature initialization, which is again mandatory for the new PyEnum forgiveness feature. This allows to remove much initialization code and makes the Shiboken startup less vulnerable. Task-number: PYSIDE-1735 Change-Id: Iaed4275d7e204fb242b1466cd6d2c09ad10002b5 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 06448ba29c2e568f64132b81ce56ec2b063e456c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* shiboken6: Simplify smart pointer types when searching instantiationsFriedemann Kleint2022-07-031-7/+11
| | | | | | | | | | | | | | When the code model first sees a "foo(const SmartPtr &)" instead of "foo(SmartPtr)", compilation would break since const, & propagate into the generated type name. Simplify types as is done for containers as well. Task-number: PYSIDE-454 Change-Id: I1d9f75aceb983f8e9c4a28314db94b8d83b1c1ca Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 6d81913ed1189a5c7b1e26d2456f05e8e8684914) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* libshiboken: Remove old code paths for static stringsFriedemann Kleint2022-06-271-59/+0
| | | | | | | | | | | PyUnicode_InternFromString() should be used unconditionally. Amends a09a1db8391243e6bb290ee66bb6e3afbb114c61. Task-number: PYSIDE-1960 Change-Id: I80837b2b58c9eadbd2aca4279df10e2f03e30450 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 71d97ff54ba2ea225d4fb215b3dbbf7feeab489a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* libshiboken: Fix crashes with static strings in Python 3.11Friedemann Kleint2022-06-241-2/+17
| | | | | | | | | | | | | In Python 3.11, some strings come with a refcount above decimal 1000000000, apparently indicating that they are interned. Replace the mechanism by PyUnicode_InternFromString(). Task-number: PYSIDE-1960 Change-Id: I6436afee351f89da5814b5d6bc76970b1b508168 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit a09a1db8391243e6bb290ee66bb6e3afbb114c61) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* libshiboken: Fix build with numpy 1.23.0Friedemann Kleint2022-06-231-0/+5
| | | | | | | Change-Id: I885c332d6c948820140946c73ae1926e88834143 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 1422cf4a7f277fb13fd209f24a90d6c02641497d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* shiboken6/Doc generator: Fix index pagesFriedemann Kleint2022-06-231-2/+2
| | | | | | | | | | | | Insert a new line before "List of Classes", fixing: QtCore/index.rst 251 WARNING: Block quote ends without a blank line; unexpected unindent. Amends 530cfb8c9fb3a050635577afa5ae23145a3ecc30. Change-Id: I15f55d224afa8c189d49cdd406d7c9f64ad9d82b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 0b37c63608b3d94f2b73eeec5f599d8af1cd9daa) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* shiboken6: Do not consider move constructors for tp_initFriedemann Kleint2022-06-211-1/+3
| | | | | | | | | | Manifests in class QHttpServerResponder of the new QHttpServer module. Change-Id: I6242f00aadefe60eb6ae9cde4a4f2c2bfa643a20 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit bc17293f08a0fa1524b4b1a6cbc49fd1a59967fc)
* PyEnum: Remove the old duplication of Enums in the enclosing scopeChristian Tismer2022-06-217-13/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When implementing Python enums, the behavior of old Qt enums was copied: Every enum was also inserted into the enclosing scope. This patch removes that for two reasons: - it is inconsequent to keep an old quirk when we have all enums renewed so much - It is more consistent compared to our competitor - it is a prerequisite to implement efficient lazy initialization PROBLEM: Many constants (about 110) are no longer recognized, for instance `Qt.AlignLeft` should be `Qt.AlignmentFlag.AlignLeft`. The question is if that can be fixed easily in C++, or if the file mapping.py should get ~100 new fixes? SOLUTION: We allow the old enums, but tell nobody that they continue to work. They also are not advertized in the PYI files. [ChangeLog][PySide6] The duplication of enum values into the enclosing scope, allowing to write Qt.AlignLeft instead of Qt.Alignment.AlignLeft, is still implemented but no longer advertized in PYI files or line completion. Task-number: PYSIDE-1735 Change-Id: I79a90d08f2a5a3a069fa551e60d609ecad718239 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 304582e59e63f7620f221d3a9748118479ede099) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Shiboken: Optimize attribute access a bit moreChristian Tismer2022-06-204-2/+10
| | | | | | | | | | | | Some leftover attributes can be turned into statics, too. The StaticMetaObject needs to be moved into Shiboken in preparation of the following enum checkin. Task-number: PYSIDE-1735 Change-Id: I2172bd785ae229ea5637588c53be660477fc2f0e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit c6a9e5ab96d9221ecd8d445a38349d12c6c0d71e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PySide: speedup all cleanup calls by using PyName for staticMetaObjectChristian Tismer2022-06-171-1/+2
| | | | | | | | | | | | | | This was found when debugging attribute access for improving PyEnum (the upcoming Enum Strict patch with forgiving fallback). It provides a quick shortcut for checking attribute names without string generation. Task-number: PYSide-1735 Change-Id: I765016a5a0f13e59cef85f57deebebd456b16a77 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit b111cde848e3d8938be6214a4d377867753f4913) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PyEnum: Use embedding of the Enum module for better execution speedChristian Tismer2022-06-1710-9/+1160
| | | | | | | | | | | | | | | | | | | | | | | | | | | The Enum module was optimized several times and is now in good shape. Old Python versions show massive slowdowns. Also, Python 3.6 does not support the functional API. As a general solution, we embed the current enum version to support older Python versions with the same module. Newer Python versions do a normal import. As a side effect, we have no longer to treat the old version Python 3.6 in any special way. This change is further necessary to be able to remove the old enum version, since Python 3.6 still exists in CI. NOTE: Python 3.6 and 3.7 had a hard-to-find refcount error when creating new enums. [ChangeLog][shiboken6] Python Enums use the newest implementation for Python (3.10) for compatibility and speed. Task-number: PYSIDE-1735 Change-Id: I1f105a6b0fb48e9364cb0654ccd9118d39f68542 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 69293f068e98f428df7226fe622fdeff6dd6f891) Reviewed-by: Simo Fält <simo.falt@qt.io>
* signature module: QPixMap.save should use str instead of bytesShyamnath Premnadh2022-06-171-0/+5
| | | | | | | | | | - the parameter 'format' of QPixMap.save(...) should have a type mapping of char* -> str instead of char* -> bytes Task-number: PYSIDE-1968 Change-Id: I48f3e8da73208388b731b63c41893d917fb65d54 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 33ac539deb4c624c370aacf72b8a48e5ce1f7496) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix type hinting for QListWidget selected_indexes() returnShyamnath Premnadh2022-06-171-3/+1
| | | | | | | | | | | - the return type should be List[PySide6.QtCore.QModelIndex] instead of List[int] - remove duplicate entry for QModelIndexList Task-number: PYSIDE-1934 Change-Id: I9dfaeb15fb5e2c84008b14d96498306520ea83ba Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit a258e7fd54a7a379e179597f61bae1c8ed70b0e7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* libshiboken: Amend error message "not enough arguments"Friedemann Kleint2022-06-152-1/+5
| | | | | | | | | | | | In case no arguments at all were passed (assuming they were passed as keyword arguments which only works for optional arguments), add a note about that. Task-number: PYSIDE-1964 Change-Id: Iacaef7604f6127ce6532b31dabba8dd93e45bc78 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 3977c518195289edf7802d0d1b10ba3c2d49dd96) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* shiboken6: Fix compile error in testsFriedemann Kleint2022-06-151-2/+2
| | | | | | | | | | | | | | sources/shiboken6/tests/libsample/functions.cpp:244:33: error: use of overloaded operator '<<' is ambiguous (with operand types 'basic_ostream<char, std::__1::char_traits<char> >' and 'std::nullptr_t' (aka 'nullptr_t')) cout << __FUNCTION__ << ' ' << t << '\n'; Amends 8ecb8a909ecde13f179b8fce170582e47373f50c. Task-number: PYSIDE-854 Change-Id: Ifd2bb6ac4bf27ebcb240359020a6f8e18dbfef79 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit e5e4d388ab9a8a94c341e644ad00dd8a98980063) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QEnum: Adapt to the new enum implementationChristian Tismer2022-06-152-0/+24
| | | | | | | | | | | | | | | | | | | QEnum was implemented with Python enums, as opposed to the old C++ enums. Now that support for Python enums is built into PySide, it is necessary to keep the implementing Python modules always the same. This patch prepares QEnum and PyEnum compatibility for the upcoming embedding of old enum implementations. As a side effect: Python 3.6 and 3.7 had a hard-to-find refcount error when creating new enums. Task-number: PYSIDE-1735 Change-Id: Ic44459c8e319d6d0308c7366beafa6fe7df41b79 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 4131e4549108bc53149a45b24ccc5b3a40b6cf60) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix usage of Py_TYPE() for Python 3.11Friedemann Kleint2022-06-131-1/+1
| | | | | | | | | | | The macro was changed to a function, no longer allowing for assignment. Task-number: PYSIDE-1960 Change-Id: I4bc0e9a5c1f3dc70d59628e63b7b9d47ea449992 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 73adefe22ffbfabe0ef213e9c2fe2c56efdd7488) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* libshiboken: Fix hangs introduced by mutexFriedemann Kleint2022-06-101-7/+7
| | | | | | | | | | | Use a recursive mutex since nested locks can occur in ~BindingManager. Amends e141ea41cf6f2840281ab6e52b0861a6d1dcc137. Change-Id: I2dee3da70fe855859b3917e6ac775b8c5cdf5da7 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit a2005503162fd707d71027712f13f6b9454e78ad) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* libshiboken: Fix a crash in Shiboken::Object::isValid() for Python 3.11Friedemann Kleint2022-06-101-0/+1
| | | | | | | | | | | | | | | | | The function is passed type objects for class methods, which caused it to crash. The first clause did not catch this, and so it was cast to SbkObject below. Add a type check to prevent this. Task-number: PYSIDE-1960 Change-Id: Icfdd6fefb7156ac5961444bd5395109849a1d66e Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 52df3b8f64d08f412d7f8b12d82fc0ae6f3c741d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix deprecation of the Py_TRASHCAN_SAFE_BEGIN/END macrosFriedemann Kleint2022-06-102-0/+16
| | | | | | | | | | | Replace by Py_TRASHCAN_BEGIN/END as introduced in 3.10. Task-number: PYSIDE-1960 Change-Id: I17aaa2e9fa9c44f8c1004fc8dba8b22932ea44d0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 03928069a6781a1849245e6219f9caa64093068e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* libshiboken: Fix occasional crashes when using QMLFriedemann Kleint2022-06-031-0/+12
| | | | | | | | | | | QML calls into the generated QObject::metaObject() from threads without GIL, causing crashes for example in retrieveWrapper(). Use a mutex to guard access. Change-Id: I374ada7fc207d86a062f950751503764a5e5dddf Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit e141ea41cf6f2840281ab6e52b0861a6d1dcc137) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Limited_API: Fix PyIndex_Check once and for all: avoid warningChristian Tismer2022-06-032-5/+5
| | | | | | | | | | | | | The Windows compiler is quite overzealous and complains if headers have different ordering in the used version, although the content seems to be identical. Instead of doing a tedious search, we simply rename the function. Task-number: PYSIDE-1797 Change-Id: I88a8eca882357ac31b9eb932c89013c51c5c75e4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 563613fefd81090d1947f16259394a830681492d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Signature Module: Remove special handling of QtMultimediaFriedemann Kleint2022-06-011-16/+0
| | | | | | | | | | | QtMultimedia imported QtMultimediaWidgets apparently due to the forward declaration of QGraphicsVideoItem and QVideoWidget in Qt 5. This has been removed in Qt 6. qint64 is also declared in QtCore. Change-Id: I9721d0580e63135152365e690bc20d76ca0e63bd Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 4a3d5f9affd0ba8f6d37ad5c0cdf8d2aa52914a8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* shiboken6: Fix formatting of sequence/mapping methodsFriedemann Kleint2022-05-301-4/+2
| | | | | | | | | | | - Remove duplicated self check (writeCppSelfDefinition() also generates it) - Fix indentation of mapping method Change-Id: Ic1a9876da4efd593ab9de2adbe5879ed531d408c Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 0a1104b34e9050f8e6c974b0dfe4077a33355309) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Limited_API: Fix PyIndex_Check once and for allChristian Tismer2022-05-276-13/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PyIndex_Check was left as a macro for Python <= 3.7 . This was fixed for Python 3.8 (I failed to submit the patch in time :( ) The problem is a bit weird, because we cannot do a compile time decision which Python version it is, because exactly that is only known at runtime. Therefore: - we cannot use a builtin version of PyIndex_Check, because this would create a link error with Python < 3.8 - PyType_GetSlot would help with this, but unfortunately this worked only with heap types, and the use case is on normal integers. The solution is quite ok: ------------------------- The structure of the type objects from Python 3.6 on is compatible enough for the field offset that we need here, so on old Python versions, the old type structure can be used. From Python 3.10 on, PyType_GetSlot is extended to non-heap types, and we can simply use that. This patch can be removed completely when we drop Python 3.7 . An automated warning that suggests this removal was added. [ChangeLog][shiboken6] The handling of a complex Limited API bug was fixed for different combinations of PySide/Python versions. Change-Id: I945aa5ae1ea5cd9de7c6e140c32a1e9467735a8e Fixes: PYSIDE-1797 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit bcd1ac22f8e4e804b4082e311d4a8c43f3f3d4d6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PyEnum: Fix the old Enums to produce correct .pyi files, againChristian Tismer2022-05-272-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Before starting the PyEnum move, I always used Python to check the validity of everything in a .pyi file. I tried that with Qt enums as well, but it crashed when tested. Therefore, I did the transition to Python enums, prematurely. Later on, it became clear that .pyi files are no longer compatible to be run in Python at all, and Mypy is the checker, instead. After removing the Python self-test, the original, correct enum handling can be restored. Depending on PySide version, the .pyi files are now correctly created for old or new Enums. [ChangeLog][PySide6] Enums are now correctly handled in Python interface files, depending from the version selection. Change-Id: I79acc4d12b3c16e2624fbb0a6147bbeb40075ebb Fixes: PYSIDE-1731 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 3bd132cbaf01fe1e929e1279d5b32b3c412cdcf4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>