aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/shibokenmodule/files.dir/shibokensupport
Commit message (Collapse)AuthorAgeFilesLines
* __feature__: Ensure that features are not affected by other imports6.0Christian Tismer2021-05-032-8/+7
| | | | | | | | | | Imports should not touch the feature dict unless they are feature imports. This was a small error in the import logic. Change-Id: I16045fffb4b770861ff2efba674667894e0798e5 Fixes: PYSIDE-1548 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 39ba36db0fb8a3c722cb23e02f38abab9c67592c)
* signature: Refine the decision heuristics of result tuplesChristian Tismer2021-04-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | Result tuples do not (yet) get information from XML. Instead, they fetch their info solely from the embedded signature strings and information encoded in mapping.py . When a variable is determined as a result variable, it is removed from the arg list and normally appended to the return tuple. It turned out that a special rule is needed: A variable that comes first in the variable list should also be first in the result tuple. This heuristics should be replaced by more introspection. Right now, this suffices as a working fix. Fixes: PYSIDE-1409 Change-Id: Ib65682439e2f678380e0f58a42a36506d0766ddf Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 3506158551488788450498f9b4ffe86375172fea) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* signature: protect an unrecognized item from raising exceptionsChristian Tismer2021-04-072-2/+14
| | | | | | | | | | | | | | | | | | A special case "std::optional" caused an exception at an unforeseen place, because "std" was not recognized in an eval. Turn this into another runtime warning. Also, the "std::optional" case was added as "typing.Optional" after applying und testing the above fix. Change-Id: I722ae463d133125e96ab09aeb38f21cdc2453d5b Fixes: PYSIDE-1538 Reviewed-by: Renato Araujo Oliveira Filho <renato.araujo@kdab.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 0a47111b454b8e1582d8595cadc348b61989ff29) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* PySide import: Make imports more safe against installation errorsChristian Tismer2021-03-252-13/+16
| | | | | | | | | | | | | | | | | | | | | This patch originally was "__feature__: Make imports more safe against installation errors" After applying the patch to 5.15 with errors, it became clear that not __feature__ was a problem, but the "import PySideX.support" did not work in the embedding case. This observation made the error message concerning PyInstaller pointless. Instead, the pseudo-import of PySideX.support was fixed to work correctly in all cases. Tested on 5.15 with PyInstaller, this is now going back into dev. Manually cherry-picked to 6.0 Pick-to: 5.15 Task-number: PYSIDE-1502 Change-Id: I2fd680a6a28de00f5392147b0d050deb7663dc22 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* signature: Provide fixes and improvements, Part 1, addendumChristian Tismer2021-02-101-5/+4
| | | | | | | | | | | | | | | | | | This patch had a way too complicated method to find out if something is a method, and this broke on Python 2 because we don't have the __qualname__ attribute everywhere. But this can be done much easier: We check the type and see if it is a function or builtin function. Everything else must be a method, no matter what it is :) Change-Id: I07e5690f36e4ed4d50ea5e203233b369dc70fa5f Task-number: PYSIDE-510 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 609bd8121b9a45846b236ecf51226da026651d51) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* signature: Provide fixes and improvements, Part 1Christian Tismer2021-01-222-23/+37
| | | | | | | | | | | | | | | | | | | | The signature module is modified again to be more correct when using the mypy application. This part splits some changes which occurred when working on Shiboken.Enum inheritance. There will be a number of follow-ups: - signatures for all shiboken types - test cases for signatures - signature support for different __feature__ selections Change-Id: Ifb0d92bf7641f2909ab950e3458b3c3c68c20dad Task-number: PYSIDE-510 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 123e27090e0ec4f8d32f301700c9ff9d1b49ba2a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* sources: migration from format() to f-stringsCristian Maureira-Fredes2021-01-067-24/+25
| | | | | | | | | | This should be the last patch related the usage of f-strings from the 'sources' directory. Change-Id: I0288d720dc4930dee088ca3396a66d1b3ba18f76 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit d9f344fcef6bec04a787f9ea9f4ea94f15eaa26c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* signature: Fix the parser regex for Qt6Christian Tismer2020-12-162-14/+17
| | | | | | | | | | | | | | | Our parser regex handled everything but no single quotes. In Qt6, single quotes appeared with a backslash escape. Errors will no longer give a warning but raise a SystemError from now on, because syntax errors in the parser are not tolerable. Task-number: PYSIDE-510 Change-Id: I6790d4aa73b507160b0c3107c2aa665fe6aae49d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit be04c2df4202bcf2086348380da91fcfb28397d6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* signature: avoid duplication of `__init__`Christian Tismer2020-11-301-1/+2
| | | | | | | | | | | | | | After the reworking of error messages, the `__init__` function became visible both via the "class" and as "class.__init__". The constructor is treated specially because we want to list it first. Avoid duplicate generation of the constructor by filtering in "enum_sig.py". Change-Id: I04c0a47990d6ca8d97a748f7ecfe911f9aec2fe6 Task-number: PYSIDE-1305 Pick-to: 5.15 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* errorhandler.py: use AttributeError instead of TypeErrorChristian Tismer2020-11-251-1/+1
| | | | | | | | | | | | | | There is a small improvement needed in errorhandler.py: It was not consequent to use TypeError for missing attributes in one case, and to use AttributeError on the constructors. The error message may be different, but it always should be AttributeError. Task-number: PYSIDE-1305 Task-number: PYSIDE-1019 Change-Id: I1c278c5256000f0f0fe66ca9da36c2d078002b25 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* cppgenerator: rework keyword handling regarding unknown keywordsChristian Tismer2020-11-232-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | PySide has a distinction between functions with simple arguments and functions with keyword arguments for optional keywords. When a function has keywords specified in one or more signature branch, it gets the METH_KEYWORDS flag. In this case, it is checked that no argument is given positional and per keyword at the same time. Completely forgotten was to check which keywords are allowed in that branch, if at all. The problem was much complicated because constructors can contain extra signals and properties. At the same time, all further error messages are generated with Python. This adds necessary flexibility when features are active. All PyBuildValue objects were refcount leaking. That has been replaced by static createStaticString expressions. The `argNames` structure is no longer needed by the improved algorithm. Change-Id: Ic297912c47231720f61c7d4b79b46a1e376a9941 Fixes: PYSIDE-1305 Task-number: PYSIDE-1019 Pick-to: 5.15 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* __feature__: provide useful error message when feature is activeChristian Tismer2020-11-111-10/+4
| | | | | | | | | | | | | | | | Features seem to work quite good so far, but they clearly need much more testing. One of the problems is that error messages are produced, but the function name is not found and we get an ugly default error message. This is an efficient implementation that does all name mangling in the C code. A helper dict avoids linear search for properties. Task-number: PYSIDE-1019 Change-Id: Ic87c4a6e7dc2b2a251e809d6df0eb7fb9ca8021c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* python3: remove all obsolete "from __future__" import statementsChristian Tismer2020-11-0911-22/+0
| | | | | | | | | | | Note that not all future statements can be removed: PEP 563 for instance deals with from __future__ import annotations Task-number: PYSIDE-904 Change-Id: Ia387ec87f3c68ca64d13e8e80191eda900f58638 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* signature: provide error messages for unsupported function typesChristian Tismer2020-11-061-2/+12
| | | | | | | | | | | | | | | | | | Since class properties are now developed, we now have the case that class methods can produce errors without having a valid signature, yet. Signatures for class methods will be implemented eventually. Before that happens, we provide a default error message which shows the given arguments. This is sufficient for the moment, because errors in class methods can currently be created by class property setters only which have a quite trivial signature. Task-number: PYSIDE-510 Change-Id: I6397da114cedd628ba19c86b153e60497a0b4ddd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Rename PySide2 to PySide6Friedemann Kleint2020-11-026-91/+91
| | | | | | | | Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I845f7b006e9ad274fed5444ec4c1f9dbe176ff88 Reviewed-by: Christian Tismer <tismer@stackless.com>
* replace **locals by f-strings where possibleChristian Tismer2020-11-027-21/+19
| | | | | | | | | This change affects mostly only my own sources which were prepared for the migration to Python 3.6 . Task-number: PYSIDE-904 Change-Id: I0c2cd59f6f625f51f876099c33005ac70ca39db9 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-2815-0/+2714
Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I4cb5ee4c8df539546014b08202a7b1e98ed3ff07 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>