aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/pysidesignal.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Shiboken: Fix the oldest shiboken bug ever which shows up on Python 3.11Christian Tismer2022-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | b7df2f1c0 "Fix signal initializer.", 18. May 2010 at 00:55 There was a `PySequence_Check` in the evaluation of some signature function parameter processing, which should have been `PyTuple_Check`. Since the new PyEnums are also sequences, the new optimization in Python 3.11 changed the parameter handling in a correct way and replaced the argument tuple by a direct single argument of an enum type. And that is also a sequence ... There are probably still dormant issues like this in the codebase which gives reason to submit a task that checks all Python interface functions for correctness. Change-Id: I45996a0458c3e60795d2eb802eb98f7dd3678d92 Pick-to: 6.3 Task-number: PYSIDE-1735 Task-number: PYSIDE-1987 Fixes: PYSIDE-1988 Reviewed-by: Cristian Maureira-Fredes <[email protected]> Reviewed-by: Shyamnath Premnadh <[email protected]>
* libpyside: Add debug operators for some signal structuresFriedemann Kleint2022-06-301-0/+41
| | | | | | Task-number: PYSIDE-1978 Change-Id: I84118a41df3569329093d7f216f8dc148fe1ba2f Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* libpyside: Improve error message about using the wrong signal overloadFriedemann Kleint2022-06-301-6/+13
| | | | | | | Pick-to: 6.3 Task-number: PYSIDE-1978 Change-Id: I912d4317bc639c5c597ab8259eef4ae389af04e6 Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* Fix build with QT_LEAN_HEADERSFriedemann Kleint2022-06-231-0/+2
| | | | | | | | | Amends f88b4b646776b4d6fc8c9ab5253a0a4f89e26976. Pick-to: 6.2 6.3 Task-number: QTBUG-97601 Change-Id: I3cd27556dc975d72a3dfebb8fb16d21edf00767b Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* Use SPDX license identifiersLucie Gérard2022-05-271-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I065150015bdb84a3096b5b39c061cf0a20ab637d Reviewed-by: Friedemann Kleint <[email protected]> Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* libpyside: Add a __repr__ for PySideSignalInstanceFriedemann Kleint2022-05-031-0/+9
| | | | | | | | | PySideSignal already has a str operator, which takes precedence. Pick-to: 6.2 6.3 Fixes: PYSIDE-1911 Change-Id: I98365e75068ce4db661b3293d1336b43a94807a0 Reviewed-by: Christian Tismer <[email protected]>
* Migrate from QLatin1String to UTF-16 string literalsFriedemann Kleint2022-04-251-1/+1
| | | | | | | | | | Use the QStringView overloads of the comparison functions in order to minimize merge conflicts after the deprecation of QLatin1String in 6.4. Task-number: QTBUG-98434 Pick-to: 6.3 6.2 Change-Id: Ia0df398ab8f3e61a0b629971ccbec2273a78499b Reviewed-by: Christian Tismer <[email protected]>
* Migrate from QLatin1Char to UTF-16 char literalsFriedemann Kleint2022-04-251-7/+7
| | | | | | | | | Preparing for the deprecation of QLatin1Char in 6.4. Task-number: QTBUG-98434 Pick-to: 6.3 6.2 Change-Id: I8bc92aa9f4e6dbfcb12d2025c5a1e760ab4f0d7f Reviewed-by: Christian Tismer <[email protected]>
* PyPySide: fix callbacks with the new "builtin method" typeChristian Tismer2022-03-171-1/+23
| | | | | | | | | | | | | | | | Using this new type, two more errors concerning callbacks could be resolved: signals::qobject_receivers_test QtWidgets::bug_860 [ChangeLog][PySide6] The new PyPy "builtin method" is now handled correctly in callback functions. Task-number: PYSIDE-1843 Task-number: PYSIDE-535 Change-Id: I0f24cf6d7c0352b853f663ffcaf899d3eb77c7e8 Reviewed-by: Friedemann Kleint <[email protected]>
* Port code to use size() instead of count() of Qt containersFriedemann Kleint2022-03-171-4/+3
| | | | | | | | | | | count() will be deprecated. Fix some integer types in loops and modernize code in changed lines. Pick-to: 6.2 Change-Id: Idf21927661ea6c8866ee36e7c623043271e21620 Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* libpyside: Refactor handling of named signal argumentsFriedemann Kleint2022-03-141-13/+11
| | | | | | | | | Allocate the list of names only if the "arguments" parameter is present. Delete it in signalFree(). Pick-to: 6.2 Change-Id: I56fe3c1a50a73e7a7ae924ccb844d2bd6378a00d Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* PyPySide: Rename interface functions and classes to simplify debuggingChristian Tismer2022-02-031-28/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | The names of certain interface functions are not always following a simple scheme. Especially it is not easy to see immediately if we are dealing with a method of SbkObjectType or SbkObject Do a few renamings to simplify debugging and make the code easier to understand. When a function is used in a type spec and there is no other important reason, it should be named like {Py_<tpname>: reinterpret_cast<void *>(<TypeName>_<tpname>)}, Rename also all type functions ending on "TypeF()" to end in "_TypeF()". This is not always the case. Examples: SbkObjectTpNew -> SbkObject_tp_new SbkObjecttypeTpNew -> SbkObjectType_tp_new PyClassPropertyTypeF -> PyClassProperty_TypeF Task-number: PYSIDE-535 Change-Id: Icbd118852f2ee732b55d944ed57c7a8ef7d26139 Reviewed-by: Friedemann Kleint <[email protected]>
* libpyside: Move helper isCompiledMethod() to pysideutils.hFriedemann Kleint2022-01-191-0/+1
| | | | | | | | | | | It appears to be a general use helper function which could be useful outside signalmanager as well. Amends 56f66f128566bd08f027fee46bb42a6c4f57a26e. Task-number: PYSIDE-1755 Change-Id: I449243bb5d800ba4d271b3079ad394810d468312 Reviewed-by: Christian Tismer <[email protected]>
* Safe distinction of Nuitka compiled methodsShyamnath Premnadh2022-01-181-3/+3
| | | | | | | | | | | | | | | | | | Adds an extra check to see if __code__ is present. As mentioned in PYSIDE-1755, Mocks are callable objects without __code__ attribute, unlike Python Method or Functions. However, a Mock also has im_func__ and im__self attributes. We made the assumption __code__ would be present if im_func and im_self are present, and this makes it fall under the category of a compiled method. This patch makes an extra check to see if __code__ is present. If it is not, then the Slot (here Mock) is considered as a callable method. Task-number: PYSIDE-1755 Pick-to: 6.2 Change-Id: If7e8f52dfb2409cd856eec0d0b41891d751d8a69 Reviewed-by: Friedemann Kleint <[email protected]>
* signal: Fix equality test for inherited signals, updateChristian Tismer2022-01-121-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Signal initialization was improved by walking the MRO to find all signals. But this had the side effect that signals could be overwritten. This implementation resolves signals only once per name, so that only the most recent signal places an instance into the instance dict. Note: this does _not_ solve the equality problem of super().signal == super().signal # fails because the super call triggers a new signalInstance in the parent. This has to be addressed in a bigger rewrite if desired. [ChangeLog][PySide6] Signal initialization now respects the order of subclasses in the mro(). Change-Id: I7481576798ca272ebebf8e9a5ba875cfc94e8361 Fixes: PYSIDE-1751 Pick-to: 6.2 Task-number: PYSIDE-1431 Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* signal: Fix a segfault when signal is applied to non-QObjectChristian Tismer2021-12-231-2/+9
| | | | | | | | | | | | | | | When a signal is created on a normal Python type, this should be recognized on initialization and rejected. Instead, this creates a segfault. [ChangeLog][PySide6] A crash when inserting a signal into a non-QObject was fixed. Pick-to: 6.2 Task-number: PYSIDE-229 Task-number: PYSIDE-1675 Change-Id: I7fe1d5482ddfbf09ec1e4708c47693f2ce47c744 Reviewed-by: Friedemann Kleint <[email protected]>
* PySide6: build multiple inheritance pass-through for SignalsChristian Tismer2021-12-141-7/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | Signals always had support for calling a method that is sitting at the same place as a signal with the same name. This is done by letting the signal act as a proxy for the hidden method. Lately, the equality check of signal instances was corrected (PYSIDE-1431) which had the side effect that now some method lookups failed in multiple inheritance. This patch extends the search for homonymous methods to look not only in the signal attribute, but extends the lookup along the whole tp_mro. The related tests were slightly re-arranged to keep them together. [ChangeLog][PySide6] Signal instances allow pass-through of methods with the same name, explicitly and with multiple inheritance. Change-Id: I92828855ada7aa8d98517918008b93fc79629d8e Fixes: PYSIDE-1730 Task-number: PYSIDE-1431 Pick-to: 6.2 5.15 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Friedemann Kleint <[email protected]>
* shiboken: replace deprecated PyCFunction_Call by PyObject_CallChristian Tismer2021-12-081-12/+3
| | | | | | | | | | | This was a leftover decision, because the calls are synonyms since a long time. Found when searching incompatibilities with PyPy, but unrelated. Task-number: PYSIDE-535 Change-Id: Ibbe3687a3919bb7177bb2831f1eb35820548a480 Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* mypy-support: Improve the handling of `Signal`Christian Tismer2021-12-071-0/+2
| | | | | | | | | | | | | | | | | | | After more correct `Slot` handling, `Signal` now gets a __get__ method that always was there, but did not show up in .pyi files. By this `__get__` function and its return-type `SignalInstance`, the correct connection to `emit`, `connect` and `disconnect` is automatically there. [ChangeLog][PySide6] The MyPy display of `Signal` was corrected so that the relationship of `Signal` and `SignalInstance` is reflected. Task-number: PYSIDE-1675 Change-Id: I58e66008418147f37e0b96067d62677b6b0b902c Fixes: PYSIDE-1318 Pick-to: 6.2 Reviewed-by: Cristian Maureira-Fredes <[email protected]> Reviewed-by: Friedemann Kleint <[email protected]>
* Fix equality test for inherited signalsKyle Altendorf2021-10-291-10/+27
| | | | | | | | | | | The signal initialization code didn't walk the MRO so it only caught directly defined signals, not inherited signals. Walking the MRO to find all signals resolves this issue. Fixes: PYSIDE-1431 Pick-to: 6.2 Change-Id: Iadba9760e81f88478da4f3ac30e9885c4f568df5 Reviewed-by: Friedemann Kleint <[email protected]>
* Shiboken: simplify and refactor more after PyTypeObject changeChristian Tismer2021-09-291-20/+17
| | | | | | | | | | | | | | | | | | | After the move to general PyTypeObject usage, some refactoring is possible: In pysidesignal.cpp, the function `getTypeName` is refactored. The name "type" should be used for PyTypeObject if possible. In cppgenerator.cpp, a lot of reinterpret_cast calls can be avoided, also the local variable `pyType` can be used conveniently in function `writeConverterRegister`. In basewrapper.cpp, the function `introduceWrapperType` is simplified, and the part relevant for PyPy is clearly separated. Task-number: PYSIDE-535 Change-Id: If0fffbad7ee04f92d25111a8620263c8973a7bf0 Reviewed-by: Friedemann Kleint <[email protected]>
* PyPySide: adjust more to PyPy's needsChristian Tismer2021-09-291-1/+1
| | | | | | | | | These are the stable changes which are definitely needed for PyPy to work. Other changes are unclear and stay in the open PyPy patch. Task-number: PYSIDE-535 Change-Id: I660fba3bba9274026cffe0c21498ac57eb5c3b53 Reviewed-by: Friedemann Kleint <[email protected]>
* PyPySide: Encapsulate type generation to be PyPy compatibleChristian Tismer2021-09-151-8/+1
| | | | | | | | | | | | | | | | | | Type generation in PyPy is critical. When type creation calls PyType_Ready, PyPy freezes the current state of the type object. That has fatal effects, because with the Limited API, we need to patch some types a little _after_ creation. The functionality of this patch is still the same, but type creation is totally encapsulated, and we can do a different implementation for PyPy. [ChangeLog][PySide6] PyPySide: Type creation was completely encapsulated. The implementation can now be rewritten for PyPy. Task-number: PYSIDE-535 Change-Id: Iae0cadb15b631344ae76cea8c104d4b69941c2b0 Reviewed-by: Friedemann Kleint <[email protected]>
* Shiboken: Change type(SbkType_FromSpec) to PyType_ObjectChristian Tismer2021-09-131-9/+3
| | | | | | | | | | | | This step prepares the transition of type generation to PyPy compatibility. [ChangeLog][shiboken6] SbkType_FromSpec() has been changed to return a PyType_Object *. Task-number: PYSIDE-535 Change-Id: I74e2e527e66a41f1a9f3f911f44d641139371889 Reviewed-by: Friedemann Kleint <[email protected]>
* Remove SbkObjectType from the APIFriedemann Kleint2021-09-131-3/+3
| | | | | | | | | | Leave only a deprecated typedef. Complements a4311711eb89e3f9833a05edf3debdf7563a104f. Task-number: PYSIDE-535 Change-Id: Icab9e82e7bff99363c01e471db1c84ee8d6c0b6b Reviewed-by: Christian Tismer <[email protected]>
* Define SbkObjectType to be a PyTypeObjectFriedemann Kleint2021-09-111-1/+1
| | | | | | | | | | | | | | | SbkObjectType was a struct embedding a PyTypeObject after fec1611e9f42c1f0a13eb33474df2ed8ee480842. Remove that and make the types equvivalent, which allows for removing many reinterpret_casts. SbkObjectType is left as a typedef for client code snippets. [ChangeLog][shiboken6] SbkObjectType is now a typedef for PyTypeObject. Task-number: PYSIDE-535 Change-Id: I44812311ccbbe0988c38e34c47d16f6874f8d1cf Reviewed-by: Christian Tismer <[email protected]>
* Shiboken: Remove cheating macrosChristian Tismer2021-08-061-1/+1
| | | | | | | | | | | | | | | There are a number of cheating macros that allow to use the same code in Python 2 and 3. Because Python 2 is gone, remove these macros. This conversion was partially difficult since certain types collapsed in the XML files and generated functions contained substrings of the macros. This is actually the fourth attempt. Task-number: PYSIDE-1019 Pick-to: 6.1 Change-Id: I116877afc8aa36f4710a40df1769f600b6b750ea Reviewed-by: Christian Tismer <[email protected]>
* Return QMetaObject.Connection from QObject.connect()Friedemann Kleint2021-07-021-1/+15
| | | | | | | | | | | | | | | [ChangeLog][PySide6] QObject.connect() now returns an instance of QMetaObject.Connection which can be used to disconnect instead of a bool. Change the code to return QMetaObject::Connection and add an overload for Signal.disconnect() taking a connection. Fixes: PYSIDE-1334 Change-Id: I0413888828b2e82bad49812b4918c1d6a8133c5c Reviewed-by: Christian Tismer <[email protected]> Reviewed-by: Cristian Maureira-Fredes <[email protected]> Reviewed-by: Qt CI Bot <[email protected]>
* libpyside: Add type check for PySideSignalInstanceTypeFriedemann Kleint2021-06-091-0/+6
| | | | | | | Pick-to: 6.1 Task-number: PYSIDE-1482 Change-Id: I00d30c95bd5835b6d904bc28f671e284017fffb5 Reviewed-by: Christian Tismer <[email protected]>
* Nuitka: Allow for compiled functions and methods tooChristian Tismer2021-03-261-14/+97
| | | | | | | | | | | | | | | | | | | | | | The author of this patch is Kay Hayen. He writes: * Add support for compiled methods to the bindings manager. * For slots, implement lookup of code objects for compiled methods and functions with a new function avoiding code duplication. * Look up attributes of slots, e.g. code objects that Nuitka also has as well, methods have "im_func" and "im_self". * Sometimes calling "tp_descr_get" Python object slot is the universal thing to do, covering all types. * Detect compiled methods as receiver targets too. Task-number: PYSIDE-1523 Change-Id: I0277b583840710476198ed5e1ccaaccd672e7638 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* libpyside: Fix some clang analzyer warningsFriedemann Kleint2021-03-111-38/+38
| | | | | | | | | | | | - Use nullptr - Initialize variables - Remove else after return - Remove C-style casts - Avoid constructing QString from const char * - Use emit for signals Change-Id: I6ba8cad51f4b2a22f94996d1a9d8c3ae87c35099 Reviewed-by: Christian Tismer <[email protected]>
* Clean up some warnings produced by Qt Creator's clang/clazy code checkersFriedemann Kleint2021-01-211-4/+2
| | | | | | | | | | - Remove unused variables - Remove assignments that do not have any effect - Fix mixing const/non-const iterators - Fix for loops, use const ref and/or qAsConst() Change-Id: I4b52f11030493c440026b194f18ec0151a3ea710 Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* signature: Provide fixes and improvements, Part 1Christian Tismer2021-01-211-5/+5
| | | | | | | | | | | | | | | | | | | | 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 Pick-to: 6.0 Pick-to: 5.15 Task-number: PYSIDE-510 Reviewed-by: Friedemann Kleint <[email protected]>
* Rename PySide2 to PySide6Friedemann Kleint2020-11-021-0/+1040
Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I845f7b006e9ad274fed5444ec4c1f9dbe176ff88 Reviewed-by: Christian Tismer <[email protected]>