aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/libshiboken
Commit message (Collapse)AuthorAgeFilesLines
* Shiboken: Fix a potential refcounting bug in Lazy InitChristian Tismer32 hours1-2/+3
| | | | | | | | | | | | Keeping a reference to the original import function is needed in case someone else modifies import, too. Thanks to Tony Roberts for this finding. Change-Id: I6c362698e86e57b1a27cdd9367a89705e944825f Fixes: PYSIDE-2780 Pick-to: 6.7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix non-unity buildFriedemann Kleint37 hours1-0/+1
| | | | | | | | | | | | Amends c7c7dc9ba6da83f26d2ecda33a9af58d3f8f5f20, 11afd18d34c17a345315d226b6124dc1fd31d12c and 28d04cae204881392ddc0826a570d05ba82c5ee0. Pick-to: 6.7 Task-number: PYSIDE-2404 Task-number: PYSIDE-2768 Change-Id: I7caed5c4bddfaa594dfb692d5e087e0c88208e3e Reviewed-by: Christian Tismer <tismer@stackless.com>
* Lazy Load: Fix smart pointers with converters to smart pointers to pointee baseFriedemann Kleint4 days1-1/+0
| | | | | | | | | | | | | Smart pointers for which additional conversions to smart pointers to base classes of the pointee were registered after the type creation caused a crash with the lazy loading since getConverter() returned 0. Move these functions into the wrapper source and register them from the type creation functions. Task-number: PYSIDE-2404 Change-Id: I5f151748018c9cd84487ca92dee9cf4a42f7e4a7 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Lazy Load: Disable lazy for PyPyFriedemann Kleint4 days1-2/+13
| | | | | | | | Pick-to: 6.7 Task-number: PYSIDE-535 Task-number: PYSIDE-2404 Change-Id: I6d05e73457de7d12213bf9b046359355fcb0a941 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Lazy Load: Fix crash caused by global enumerations in samplebindingFriedemann Kleint4 days2-1/+2
| | | | | | | | | Ensure PyEnumModule is set. Pick-to: 6.7 Task-number: PYSIDE-2404 Change-Id: Ie7b127129eba583a02e3b2d33ae640cea84bfb59 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Lazy Init: Fix crash when setting an error messageFriedemann Kleint12 days1-2/+2
| | | | | | | | | Amends c828416efc0b88747cab85d941a149d91487466f. Task-number: PYSIDE-2404 Pick-to: 6.7 Change-Id: Iab9082751e40c16ccf6cd47bdefdde220febb301 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* libshiboken: Remove left-over declarations of lazy loading functionsFriedemann Kleint13 days1-12/+0
| | | | | | | Pick-to: 6.7 Task-number: PYSIDE-2404 Change-Id: I7e5838c6da45cf6ec24d3ef623ae6d34f04d9177 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* libshiboken: Fix warning about unused variable in release modeFriedemann Kleint13 days1-2/+1
| | | | | | | | Amends f34dcb84adf20e9f3428660636aa8d377d14fc3b. Pick-to: 6.7 Change-Id: I399ac7623b05e16d904199da621a969a20ccaf0a Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* shiboken6: Exclude enums from type checks for function arguments of type ↵Friedemann Kleint2024-05-272-0/+8
| | | | | | | | | | | | | | | | | | | | | | | sequence Enums have an __iter__ attribute, which causes them to match in Shiboken::checkIterable(). For example, when passing a string and QDir::Filters to QDirListing(QString,QDir::Filters) QDirListing(QString,QStringList,QDir::Filters={}) the second overload will be picked. Since this is not intended, introduce a new check function Shiboken::checkIterableArgument(), which excludes enums. [ChangeLog][shiboken6] Enumerations will no longer match in function argument checks for "PySequence". Task-number: PYSIDE-2620 Change-Id: I6285b6fa1f4f7f8b19e162c5031409f4c3fe3983 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Improve error handling when calling Python overrides of virtual methodsFriedemann Kleint2024-05-272-1/+51
| | | | | | | | | | | | | When calling into Python overrides of virtual methods, there is mostly no Python context and so, potential errors, for example caused by misguided duck-punching, appear as error messages without context. To fix this, add an optional context string parameter to storeErrorOrPrint() and a special method for virtuals that formats class and method name. Change-Id: Ibbaf63c163edeb9bf8fcd364c108179c2ac6a069 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add PyException_GetArgs()/PyException_SetArgs()Friedemann Kleint2024-05-272-0/+29
| | | | | | | | | The functions were added to the stable API in 3.12 and can be used to change exception messages. Change-Id: I980263553205906d692240f4934ef8c6b43464ef Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: add missing includeSamuli Piippo2024-05-271-0/+1
| | | | | | | | | | | | | | | | Amend b829abcc7b2e9fcdb027e653a6a52cdb0706de11 and add missing include to fix: | sbkmodule.cpp:459:15: error: ‘Shiboken::Conversions’ has not been declared | Shiboken::Conversions::clearNegativeLazyCache(); | ^~~~~~~~~~~ Pick-to: 6.7 Fixes: PYSIDE-2765 Task-number: PYSIDE-2749 Task-number: PYSIDE-2404 Change-Id: I13625848bff3b0e90a53649104d6e5d84553a984 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shibokenmodule: Handle nullptr (non-existent) in dumpConverters()Friedemann Kleint2024-05-221-0/+4
| | | | | | | | | | Complements cc573b9012a9d5ddfa78f75ccaf0f6f6c35fe50a, 6aa42b05ad9af0c92c43e696ea1d66612b42da4d. Task-number: PYSIDE-2404 Task-number: PYSIDE-2749 Change-Id: I5452219e6de7ff515c7e0e20b3b992f204ab4863 Reviewed-by: Christian Tismer <tismer@stackless.com>
* LazyInit: Optimize access to non-existing types by cachingChristian Tismer2024-05-213-3/+39
| | | | | | | | | | | | | | | | The function loadLazyClassesWithName() is no more repeatedly called, because some non-existent types produce permanent overhead. Instead, we ask a negative cache and therefore shortcut repeated failures. The cache is extremely efficient since it re-uses the same mapping as the converters in question. Thanks to frkleint. Fixes: PYSIDE-2749 Task-number: PYSIDE-2404 Change-Id: I675fe5047afe3773b66c8619aa043e66586d48a4 Pick-to: 6.7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libpyside: Remove duplicated LoadLazyClassesWithName() call, take 2Christian Tismer2024-05-211-8/+1
| | | | | | | | | | | LoadLazyClassesWithName() is already called from getConverter(). This applies to sbkconverters as well. Task-number: PYSIDE-2404 Task-number: PYSIDE-2749 Change-Id: I672b1bffdfb01093ef1c47e3aa4b03120fcb36b7 Pick-to: 6.7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix running on Fedora 40 with Python 3.12.3-2Friedemann Kleint2024-05-171-4/+1
| | | | | | | | | | | | | | libshiboken initialization was failing with: Fatal Python error: [libshiboken] Failed to initialize Shiboken.BaseWrapperType metatype: No module named 'xxsubtype'. Remove the import and activate the Python 3 code as mentioned in the comment. Fixes: PYSIDE-2747 Pick-to: 6.7 6.5 6.2 Change-Id: Iaf1270793312b23613e1cf9cffd82396f5e2173f Reviewed-by: Christian Tismer <tismer@stackless.com>
* Python 3.12: Avoid issues with reference counting of immortal Python typesFriedemann Kleint2024-05-161-3/+3
| | | | | | | | | | Use the PY_RETURN_* macros for returning them. Pick-to: 6.7 6.5 Task-number: PYSIDE-2747 Change-Id: I48db8b958925e6ae39ce8ae8fb926429d0e4cd02 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libshiboken: Clean up check_PyTypeObject_valid() a bitFriedemann Kleint2024-05-161-8/+8
| | | | | | | | | | | Simplify initialization and invoke Py_DECREF() on the PyObject instead of the PyTypeObject in case Py_DECREF() is turned into a proper function. Pick-to: 6.7 Task-number: PYSIDE-2747 Change-Id: I0deae075b0e32aad9c7ea0ad8198219f540d05de Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libshiboken: Improve error handling when basic type creation failsFriedemann Kleint2024-05-151-4/+21
| | | | | | | | | | | Crashes have been observed on Fedora40 using Python 3.12.3.2 due to nullptr being passed to PyType_Ready(). Check for nullptr as well and try to retrieve the Python exception. Pick-to: 6.7 Task-number: PYSIDE-2747 Change-Id: Idb9565fa4bc1da78fcbbd5aeeec7cbe9758b1709 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Limited API: Add PyErr_GetRaisedException()Friedemann Kleint2024-05-152-0/+23
| | | | | | | | | Added to stable API in 3.12. Pick-to: 6.7 Task-number: PYSIDE-2747 Change-Id: I2d255cc20ffe7a715fc97e884fd195616d3e2296 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Lazy Init: Support Lazy SubtypesChristian Tismer2024-05-141-60/+86
| | | | | | | | | Laziness is now complete. All subtypes are supported. This saves another 8-9% of startup time. Task-number: PYSIDE-2404 Change-Id: I3f89f8d0195fbeedd3e231ac2e99efa6eadee5bc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Also check the downcast for types found by dependency graph lookupFriedemann Kleint2024-05-141-1/+2
| | | | | | | | | | | | | Try to be on the safe side. This should trigger only in very rare cases (polymorphic ids used for hierarchies with non-virtual desctructors spanning multiple inheritance or when manually calling newObjectWithHeuristicsHelper() without type name). Amends 28d04cae204881392ddc0826a570d05ba82c5ee0. Task-number: PYSIDE-868 Change-Id: I25189b33ec7e3c6da2ca55d0560f97f1d6227f00 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shibokenmodule: Expose dumpConverters()Friedemann Kleint2024-05-132-0/+100
| | | | | | | | | Complements 193769216f60f87feb20bbffa832cc159bbe525c. Add a function creating a dump of the registered converters and their type names sorted by associated Python type object. Change-Id: I8afe39765630684f885907ff3d33623fbe6fedfc Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Shiboken: Simplify Python Error MessagesChristian Tismer2024-05-102-48/+25
| | | | | | | | | | | | | | | | | | | The function PyErr_SetString is used quite often, which has no return value. The bracketed sequence PyErr_SetString(...); return nullptr; can in most cases be replaced by a single call to return PyErr_Format(...); To simplify matters, PyErr_Format is now used everywhere. Task-number: PYSIDE-2404 Change-Id: I5988fcd2430be700415d14d7a5cc740211e61d08 Pick-to: 6.7 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* shiboken6: Make multiple inheritance cast check less restrictiveFriedemann Kleint2024-05-062-1/+29
| | | | | | | | | | | | | | | | The old code would not allow to downcast if a special cast function exists somewhere in the class hierarchy (as is the case for example for QWidget inheriting QObject and QPaintDevice). Make the check more fine-grained by actually checking whether the base class is a direct, single line inheritance base class of the type passed in. This makes the mechanism work for widgets. The corresponding test can then be relaxed. Task-number: PYSIDE-868 Change-Id: Id81fd9c3080e42009fc84e06a9bab1c8856f2c0c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix polymorphic discovery to work without namesFriedemann Kleint2024-05-061-2/+4
| | | | | | | | | | In newObjectWithHeuristics(), try the type discovery graph check for the inherited class also in case the typeName is identical to the base name (which means typeid() was not able to do resolution based on virtual tables). Change-Id: Ia8912a4860a580418438f659b7a854647657ab9a Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libshiboken: Split the Shiboken::Object::newObject() functionFriedemann Kleint2024-05-062-10/+84
| | | | | | | | | | | | | | | | | | | Remove the bool exactType parameter from the existing newObject() by splitting it into 3 functions: newObjectForType() creates an instance for the type passed in. newObjectWithHeuristics() takes an additional typeName parameter obtained from typeid().name() on the C++ pointer which may contain the derived class name and also tries to find the most derived class using the type discovery graph. newObjectForPointer() is new and contains a test for multiple inheritance in the inheritance tree (disabling use of the most derived class) which was previously generated into the code. Change-Id: Ic0a25f8ec17dc20364b37062de6f20544cd2f09e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* numpy initialization: Remove superfluous PyErr_Clear()Friedemann Kleint2024-05-031-3/+1
| | | | | | | | | Amends dcbe4810a6d8abe5a870d45ee5f3e51a52a1ad76. Pick-to: 6.7 Task-number: PYSIDE-2404 Change-Id: Ib411094c6b3b430f7a84be957972d1e0c8ff94a8 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* PEP 697: Use the new type extension provision, finalChristian Tismer2024-05-023-19/+6
| | | | | | | | | | | | | | | | | | | The new embedded extra fields were not correctly addressed when a subclass of the meta type was used. This was fixed by using SbkObjectType explicitly instead of the type of an object which might be derived. This also explains the complexity of the Python API. The famous bug_825 is now fixed, too. Checked with Valgrind on Ubuntu. Task-number: PYSIDE-2230 Change-Id: Icf99ed6faab226c72bdd09f4c69018d958ede85e Fixes: PYSIDE-2676 Pick-to: 6.6 6.7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Revert "PEP 697: Use the new type extension provision, amended"Christian Tismer2024-05-023-33/+20
| | | | | | | | | | | This reverts commit adb609270e54177024fbcbd9aab7f168a7205dec. Reason for revert: The real fix is much simpler and complete. Change-Id: I07171bcd28fd3f9aa21ddde3130b755aecb62e7d Pick-to: 6.6 6.7 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libshiboken: Refactor base type visitorFriedemann Kleint2024-04-302-170/+77
| | | | | | | | | | | | | | | | Replace the walkThroughClassHierarchy() function using HierarchyVisitor-derived class by a template function walkThroughBases() taking a predicate. The name walkThroughClassHierarchy() was misleading since it really only visits the first level of base classes relevant for C++ object allocation. Make the functions using it static except getNumberOfCppBaseClasses() which is used outside basewrapper.cpp. Change-Id: Id3b7e81d6d6a6c4a4eae7322ec1a9f151f5d5ae1 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libshiboken: Clarify explanatory comment of is_user_type flagFriedemann Kleint2024-04-301-1/+2
| | | | | Change-Id: I78b5d065985002342870ad2538a5db4684f327f8 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* shiboken6: Lazy-initialize the dependency graphFriedemann Kleint2024-04-253-22/+62
| | | | | | | | | | | | | | | | | | | | | Change the dependency graph in the BindingManager from PyTypeObject *-based nodes to nodes which are wrapping the TypeInitStruct * and hashing on the type name. This allows for creating the types on demand when walking along the edges and calling the type discovery functions. This only creates the required types instead of the entire lazy group of polymorphic classes. The graph is now populated by from the generated code using a function named initInheritance() instead of dynamically from introduceWrapperType. Task-number: PYSIDE-2404 Task-number: PYSIDE-2675 Pick-to: 6.7 Change-Id: I030d4957c221f4defbb7cc52a6927287b70d9864 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libshiboken: Extract a template base class for the dependency graphFriedemann Kleint2024-04-251-19/+24
| | | | | | | | Task-number: PYSIDE-2404 Task-number: PYSIDE-2675 Pick-to: 6.7 Change-Id: I4121275e3a89a60cdac38a02bf1cf41619270946 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Revert "Lazy Load: Fix polymorphic classes by identifying lazy groups"Friedemann Kleint2024-04-252-181/+5
| | | | | | | | | | | | | This reverts commit 9f09e1dda0f167432110a22db6f9a5accf800734. Let's try to make the dependency graph lazy. Revert the change, excluding the test bits. Task-number: PYSIDE-2404 Task-number: PYSIDE-2675 Pick-to: 6.7 Change-Id: I0d28678f09834a09255dce28862e0970d68ac9fa Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* libshiboken: Refactor type discovery graph handlingFriedemann Kleint2024-04-253-34/+51
| | | | | | | | | | | | | | | Replace BindingManager::.resolveType() by a new function BindingManager::findDerivedType() which does exactly that and returns a pair of type/cptr instead of modifying the in-parameter. As a drive-by, remove a unused variable in BindingManagerPrivate. Task-number: PYSIDE-2404 Task-number: PYSIDE-2675 Pick-to: 6.7 Change-Id: I5b39ea8370b0fc1a196feb6934306f1f1dfeb8b3 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* PEP 697: Use the new type extension provision, amendedChristian Tismer2024-04-243-20/+33
| | | | | | | | | | | | | | | | The new embedded extra fields were not correctly initialized. For that, an extra meta class was necessary. This bug could not be seen on macOS, probably due to other memory allocation rules. The famous bug_825 is now also fixed. Change-Id: I44ee3b363dda77c4e21951fe2a5385c0368df0cb Task-number: PYSIDE-2230 Fixes: PYSIDE-2676 Pick-to: 6.6 6.7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Fix leaking tuples in introduceWrapperType()Friedemann Kleint2024-04-242-13/+11
| | | | | | | | | | | | | | | | | When calling introduceWrapperType(), the generated code creates and leaks a tuple of base types if there are base classes. When there are no base classes, a tuple (containing SbkObjectType) is created and leaked within introduceWrapperType(). To fix this, generate the complete tuple including SbkObjectType in the generated code and remove the base type parameter to introduceWrapperType(). Pick-to: 6.7 Task-number: PYSIDE-1617 Change-Id: Ib3bec8e6b94bea14a46df826667373d3f859dfd5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Lazy Load: Fix polymorphic classes by identifying lazy groupsFriedemann Kleint2024-04-232-5/+181
| | | | | | | | | | | | | Classes with a polymorphicIdValue have an expression which may reference a related class. We use that to identify a lazy group, which has to be initialized at once. This is now completely solved. Pick-to: 6.7 Fixes: PYSIDE-2675 Change-Id: I957a1b2b95d37b96cc2e98082fc7f92e601322cb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken: improve the display of disassembleFrameChristian Tismer2024-04-231-6/+16
| | | | | | | | | | Some more info is displayed, especially the current file name which is sometimes not obvious (frozen modules). Task-number: PYSIDE-2675 Change-Id: Iceb97fb1a28da2cf0ef9e28ff6bd158a3bfb2e88 Pick-to: 6.7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shibokenmodule: Expose dumpTypeGraph(), dumpWrapperMap() from the binding ↵Friedemann Kleint2024-04-222-34/+76
| | | | | | | | | | | | | | | | | | manager This is helpful for gaining some insight into the instantiated wrappers and registered types. Move the existing graph generating code out of the graph class and format the nodes with a short name and tooltip and expose it as dumpTypeGraph(). Similarly, rewrite expose showWrapperMap() to use streams and expose it as dumpWrapperMap(). Pick-to: 6.7 Change-Id: I5cff442b7285388403dcf1c9f96fa8808c7b2d05 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Introduce verbose switching for the debug operatorsFriedemann Kleint2024-04-192-7/+32
| | | | | | | | | | Add Shiboken::debugVerbose and Shiboken::debugBrief iostream manipulators to control the verboseness of the debugPy(Type)Object structs. Make brief the default. Pick-to: 6.7 Change-Id: I4d29f730470eacb328c886cd142472798e21fd10 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libshiboken: Remove unnecessary std::string usageFriedemann Kleint2024-04-181-1/+1
| | | | | | | | | Amends 7accf7c3042e3f0680fa0615a0f13b54d28a0efd. Pick-to: 6.7 Task-number: PYSIDE-2404 Change-Id: I80db321cb770ba2496e24520970ed519925ecffc Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* signature: Fix an old refcounting bugChristian Tismer2024-04-041-1/+1
| | | | | | | | | | | | | | | | | | | This bug was a long existing oversight since 2018-10-14 ! amends 2533dab013455bf94da2d4766e54abaf4d735e1e This bug has been hiding undetected for a really long time between innocent lines of code since version 5.15. But now someone has finally uncovered it and it will be brought to justice. Actually, I should be ashamed of myself. Thanks to Joris van Rantwijk for finding this glitch. Change-Id: Id86db1caea8c18c3a2d4d1707c0101fe8aa3d6d8 Task-number: PYSIDE-795 Fixes: PYSIDE-2660 Pick-to: 6.5 6.6 6.7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Implement multiple inheritance correctly, 2nd. amendmentChristian Tismer2024-03-281-0/+6
| | | | | | | | | | | | | When a Python class does _not_ implement __init__, then we might get the default of object.__init__, which must be skipped like the object class alone. Change-Id: I0416c97854e8d1c9edf0b9ac44d3df58223fef84 Fixes: PYSIDE-2654 Task-number: PYSIDE-2294 Pick-to: 6.5 6.6 6.7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix handling of longs exceeding long long max in float conversionFriedemann Kleint2024-03-261-1/+1
| | | | | | | | | Use PyLong_AsDouble(). Pick-to: 6.7 6.6 6.5 6.2 Fixes: PYSIDE-2652 Change-Id: I97787ba9dd6cb348e45b43228cad4a87afe54a7b Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Debug operators: Fix handling of longs exceeding long long maxFriedemann Kleint2024-03-261-2/+9
| | | | | | | | | | Use PyLong_AsUnsignedLongLong if an overflow occurs. Use hex for those large values. Task-number: PYSIDE-2652 Pick-to: 6.7 6.6 6.5 6.2 Change-Id: I9c3404cf8b01b1fcda20516c1105797fc512ed53 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Lazy Init: Evict the Achilles Heel of Laziness and fix NuitkaChristian Tismer2024-03-211-50/+53
| | | | | | | | | | | | | | | Instead of using the external __getattr__ attribute, patch the module tp_getattro function globally. NOTE: The error was a rare racing condition in Nuitka which was fixed by early insertion of a module into sys.modules . The Achilles heel was not the cause. Task-number: PYSIDE-2404 Change-Id: I929a9187f77cde7cde8318db28d4404b8ba8c1b3 Pick-to: 6.7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* LazyInit: Move the get arguments into a static structureChristian Tismer2024-03-134-12/+35
| | | | | | | | | | | | | | | | | | | | The central get function is used very often. Since the string constants are repeated many times and there seems to be no constant folding, it is better to re-arrange the structure a bit to avoid code bloat. By moving the get arguments into a struct, we avoid all repetitions of string constants and minimize the runtime overhead. The structure is now fully backward compatible and works with unchanged scriptableapplication. Task-number: PYSIDE-2404 Change-Id: Ie7c788ef75cc3d58366532c5f14ab013ebd792b5 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* LazyInit: Implement Lazy Initialization by Delayed Module EntriesChristian Tismer2024-03-137-7/+486
| | | | | | | | | | | | | | | | | | | | Lazy init is done by module entries which are delayed. Although visible in the module, the classes are only created when actually accessed by getattr. Internally, the access to the global Init_xxx functions is redirected to a Shiboken::Module::get function which resolves the classes if not already present in the global type array. PYSIDE6_OPTION_LAZY 0 - no lazy loading 1 - lazy load all known modules 2 - lazy load all modules Task-number: PYSIDE-2404 Change-Id: I98c01856e293732c166662050d0fbc6f6ec9082b Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>