aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken
Commit message (Collapse)AuthorAgeFilesLines
* libshiboken: Use std::set::find() instead of searching the setFriedemann Kleint2018-07-191-1/+1
| | | | | | Task-number: PYSIDE-727 Change-Id: Ia79f34ed466eb7652946e49db6ef6db8dd9fa03d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix limited API incompatibility with Python 3.7Christian Tismer2018-07-103-77/+8
| | | | | | | | | | | | | | | | | When Python 3.7 appeared, the structure of pystate.h was changed, substantially. Unfortunately this structure contains the trashcan code, which is only available as a macro and not part of the limited API. This code is normally not used by application programs. It prevents crashes when chains of millions of objects are deallocated. I disabled this for now when the limited API is active. As soon as somebody complains about crashes, I will try to implement it again in a safe way, but I am not sure if it is worth it in the first place. Task-number: PYSIDE-737 Change-Id: Id0daf391448ddcb9df3d299f859ef024714fa736 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Adapt Licenses to Python 3.7.0Christian Tismer2018-07-092-14/+15
| | | | | | | | | | | Certain Python files were no longer used when moved to Python 3.7.0 . To finish that, these files are now also removed from the source. As a consequence, qt-attribution files needed to be changed. I took the chance to also update the license files to the new version. Change-Id: If058d1013f1d8cb937ee0305a5eb21ae2ebdd4e0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix Limited API and Signature Glitches in Python 3.7Christian Tismer2018-07-092-5/+4
| | | | | | | | | | | | | | | | | When the homebrew version of Python 3.7 appeared so unforeseen early, I felt inclined to fix these glitches, immediately: In Python 3.7, the typing module was more changed than expected. Since we don't support versions below 3.5, it was easy to fix by avoiding to copy typing.py for version 3.x, altogether. It stays there for Python 2.7 . Furthermore, the Python issue 33738 will later be solved than the code expected, so I fixed that one for all by a macro definition. Task-number: PYSIDE-741 Change-Id: Ia56ccd1ef20cb9536b1d39f190e011e5dccf1f22 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove Py_TPFLAGS_HAVE_VERSION_TAG in Python 3Boxiang Sun2018-07-051-0/+6
| | | | | | | | | | | | | The Py_TPFLAGS_DEFAULT in Python 3 has the Py_TPFLAGS_HAVE_VERSION_TAG flag, which causes the type attribute cache in _PyType_Lookup. According to the Shiboken implementation for Python 2, this is not we expected. So remove the Py_TPFLAGS_HAVE_VERSION_TAG flag from Py_TPFLAGS_DEFAULT in Python 3. Task-number: PYSIDE-60 Change-Id: Id731a59b65640eb5adea56fe06e0deb58ac4a168 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add ownership condition for finite PySequencesCristian Maureira-Fredes2018-07-031-1/+8
| | | | | | | | | | | | | | | | | | | | | After the fix for PYSIDE-441, another issue appeared related to QVariants and PySequences PYSIDE-641, which was related due to the nature of this python data type. The problem had the same root cause, using PySequences assuming they are always finite, but not including the case of a class implementing the __getitem__ method without a length. The fix for PYSIDE-441 did not include the option of having incomplete PySequences, so this change add an extra condition to transfer the ownership of a incomplete PySequence element. Task-number: PYSIDE-671 Change-Id: I72ed1f5ea51c0c5b5a40ec51ab850732eea3c3b9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Prepare Limited API for Python 3.7Christian Tismer2018-06-263-94/+132
| | | | | | | | | | | | | | | PySide has successfully been tested with the Python 3.7 branch. There will be no change in the areas that are important for us. It is then safe to bump the supported version and the limited API version checks to fully include Python 3.7. The macro errors in the limited API was fixed by a pull request, but it was too late to get it into 3.7rc1. The error workaround was therefore extracted into pep384_issue33738.cpp and will be deactivated later. Change-Id: Iec3f277b02cac03a5cf44cbcf955ddc690c112e5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix QVariant conversions when using PySequencesCristian Maureira-Fredes2018-06-211-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we transform QVariant arguments to internal types, starting from the Python ones, to others related to shiboken. After checking if the current object is a PyDict we proceed to check if it's a PySequence. PySequence is the complementary 'sequence-like' type of PyDict, and allows finite and infinite sequences, like lists or generators. The problem is that when one implements a class which includes the __getitem__ method, Python already thinks that it correspond to a PySequence, then we try to get the elements to transform into a QList<QVariant> but it fails at the first attempt. The solution was to not assume that all PySequences have finite length (or a length), and also to have a fallback case similarly to the PyDict treatment, wrapping the PyObject as a QVariant. Task-number: PYSIDE-641 Change-Id: I3b755f47ed076147024de38e5e0a86932d981f88 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Undo renaming of Pep384_InitChristian Tismer2018-06-063-3/+3
| | | | | | | | | | | | The functions which were named Pep384XXX were renamed in order to get "PepType" as a function-like macro that suggests the similarity between "PyTypeObject" and "PepTypeObject". But the renaming of the module initialization function was not intended. Change-Id: I555633ccbd8e1354c27f2c1957c81905be54d86b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix glitch in voidptr.cpp after the PEP 384 commitChristian Tismer2018-06-051-2/+7
| | | | | | | | | | | | | | | | By lots of editing, somehow an expression in voidptr.cpp became incomplete. We should improve the current test to be certain that the VoidPtr is working. This problem can be avoided by not doing many type casts at once. Doing the same in two steps is much safer because a forgotten call would give a compile time error. Task-number: PYSIDE-560 Change-Id: Ibb24a27f439cbda490723131f34f93978725420f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Improve the QByteArray implementationBoxiang Sun2018-06-012-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The available constructors for QByteArray are now: bytes, bytearray, and QByteArray, unicode is not accepted anymore. Also the concatenation is now possible between QByteArrays. Even though is not possible to initialize a QByteArray with an unicode, we include the possibility to compare it with one (Compatibility with PyQt). The __repr__ and __str__ are now properly working. There seemed to be a confusion regarding data types between Shiboken, Python2 and Python3 related to bytes, so now the structure is based on the flag SBK_BYTES_NAME, which is define as "bytes" for Python3 and "str" for Python2. Many tests were modified to properly handle string, using the `py3kcompat` module. Task-number: PYSIDE-232 Change-Id: I8b671f367c60a0870c72dcbe5662106b3225037d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Improve sbkstring::toCString to support unicodeBoxiang Sun2018-06-011-2/+8
| | | | | | | | | | | | | If `unicode` is used in Python 2, shiboken cannot properly translate it to `const char *`. sbkstring did not supported a proper conversion of unicode types in Python2, and this change includes it. Task-number: PYSIDE-100 Change-Id: I3a70d935ad61b0e567e620c62754800370270a6b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* PEP 384-squash: Implement PEP 384Christian Tismer2018-05-3028-658/+3738
| | | | | | | | | | This is the condensed checkin of 18 commits which created the implementation of PEP 384. Task-number: PYSIDE-560 Change-Id: I834c659af4c2b55b268f8e8dc4cfa53f02502409 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use PyLong instead of PyInt for QVariantCristian Maureira-Fredes2018-05-041-0/+4
| | | | | | | | | | | | | | | | | | | Python 3 uses PyLong for integer manipulation, and since it is a valid type in Python 2 we can use it instead to have better compatibility, and avoid integer overflows. We keep the PyInt entry to avoid breaking other sections of the code when this type is required. Added a couple of PyInt_* alias to use PyLong_* ones instead. Task-number: PYSIDE-648 Change-Id: Id6af66050c5ab81fc51c1c07b1c9422a954b81c0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Change license from all the filesCristian Maureira-Fredes2018-05-0343-43/+43
| | | | | | | | | | | | | | | | | Removing the word 'project' from all the headers, and changing the PySide reference from the examples to Qt for Python: The following line was used inside the source/ and build_scripts/ directory: for i in $(grep -r "the Qt for Python project" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/the\ Qt\ for\ Python\ project/Qt\ for\ Python/g' $i;done and the following line was used inside the examples/ directory: for i in $(grep -r "of the PySide" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/of\ the\ PySide/of\ the\ Qt\ for\ Python/g' $i;done Change-Id: Ic480714686ad62ac4d81c670f87f1c2033d4ffa1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Rename PySide references to Qt for PythonCristian Maureira-Fredes2018-04-2743-43/+43
| | | | | | | | | When referring to the project one should use "Qt for Python" and for the module "PySide2" Change-Id: I36497df245c9f6dd60d6e160e2fc805e48cefcae Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* fix more qApp crashesChristian Tismer2018-04-191-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | When building PySide with a debug Python, a lot more problems become visible. They were triggered by some malicious ordering of the shutdown code, which must come *after* the refcounts of the variables are adjusted. The initial issue PYSIDE-585 was caused because the shutdown code is not only used for every created Q*Application, but also for the module shutdown, which deletes qApp_contents too often. Instead of special-casing that or adding some refcount, it was much more intuitive in that context to set qApp_content's refcount to the same value as Py_None, which also is not supposed to be garbage collected. Btw., the reason for the error message is that Py_None has it, too. When we set qApp_content's type to Py_None's type, it inherits the protection code that prevents someone from garbage collecting Py_None. Task-number: PYSIDE-585 Change-Id: I4af9de1192730f06054a5aca099a32e2392e367d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add default return value to pythonTypeIsValueTypeCristian Maureira-Fredes2018-04-191-1/+4
| | | | | | | | | | | | | | | | | | | | | When a class inherits from two base classes, Shiboken sets the converter of the newly created SbkObject to 0 (SbkObjectTypeTpNew), and handle the multiple inheritance in a different way. When any SbkObject try to release its ownership, it first verify if the ownership is already on the C++ side by checking the attribute hasOwership and also if the converter is a ValueType. The later fails if the converter is null, so a default value (false) was added. A test case using deleteLater() was included, which uses the releaseOwnership method internally. Task-number: PYSIDE-11 Change-Id: I34fba0d3e5d28b99b49a183ed08e977a311da632 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix qApp macro refcountCristian Maureira-Fredes2018-03-211-1/+6
| | | | | | | | | | | | | | | There are two borrowed references in the code, so we need to manually increase the refcount. Usually the PyEval_GetBuiltins and PyModule_GetDict functions are used locally, so there is no real need of taking care of the refcounts, but since we are using it globally, and adjusting the refcount by ourselves, it was necessary to add the missing references by hand. Task-number: PYSIDE-585 Change-Id: Icc1e7719a6b5d3654d12ab37cd509a096821d7a6 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Type system: Add attribute indicating C++ 11 enum classesFriedemann Kleint2018-02-282-4/+11
| | | | | | | | | | | | | Introduce enumeration for the type to EnumTypeEntry which can be specified by the boolean "class" attribute. For the enum classes, the value names need to be qualified by the enum name to match the C++ API. For the C++ generator, add an overload to Shiboken::createScopedEnumItem() that takes a PyTypeObject and add the enum items to the enum so that the name is in the enum scope. Change-Id: Ia0e469d13b08c196b9ddd965b9cf3cc62a38630b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2018-02-231-1/+1
|\ | | | | | | Change-Id: I5d1a4734e8f44785898ba62beaa0bdd2004fca22
| * Don't copy duplicate libraries on package installationAlexandru Croitor2018-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change makes sure to resolve symlinks and copy only one file for every dynamic shared library used (vs 3 before -> 2 symlinks + 1 actual library). This avoids duplicate files, as well as saves space when creating wheel (e.g. no 3 copies of standalone WebEngine library). This filtering happens copying from CMake install dir into pyside_package_dir (the symlinks are still present in the CMake dir, but that shouldn't harm anybody, and might be useful for users of shiboken only for example). Task-number: PYSIDE-495 Change-Id: I0fe454e16c6b254a8682aa7b1c702ec01a3064f0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2018-02-021-0/+2
|\| | | | | | | Change-Id: I777970f7bb17db766660d82556559eadd7293355
| * Fix signature extension disablingChristian Tismer2018-02-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The signature extension is a feature that can switch itself off, using the expression PY_VERSION_HEX >= 0x03040000 || \ (PY_VERSION_HEX < 0x03000000 && PY_VERSION_HEX >= 0x02070000) Unfortunately, the use of this constant when disabled became inconsistent over time. This patch corrects that and also adds a cosmetic improvement that was lost. Task-number: PYSIDE-510 Change-Id: Id1653c391d921a2c51008db2bc222d6f4bec9e90 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | libshiboken: Code cleanupFriedemann Kleint2018-01-272-47/+0
| | | | | | | | | | | | | | | | Remove apparently unused/deprecated code. Change-Id: I566014bafdcbf0b3b46e9dc836c451c64d409511 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Prevent infinite loop due to bad __getitem__ implCristian Maureira-Fredes2018-01-151-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Looking at PYSIDE-441 there was an issue regarding overloading the __getitem__ method on a class that inherits from QObject. The bug report showed that setting an object of the same class to be the parent of another object of the same class ended up causing an infinite loop when trying to get the parent element. Overloading __getitem__ implicitly converts the class into an iterator, and the developer *must* include a proper implementation of the method which raises a StopIteration exception when needed. Commonly, people that overload this method included access to class data structures where in most of the cases an IndexError is raised which forces the iteration to stop. Since the bug report did not include this code and also there was no access to any internal variable, no exception was raised and ended up causing an infinite loop. This can be replicated in python as folows: class A(object): def __getitem__(self, arg=None): print("getitem called:", arg) #raise StopIteration a = A() print(list(a)) This small fix avoids the infinite loop when the method __len__ is not implemented (length = -1) or when the length of the pyObj is zero. Without a proper implementation of __getitem__ (Raising IndexError or StopIteration) the infinite loop will happen. If __len__ is not implemented, then the application will complain, but does not matter since this is never checked during the iteration. Change-Id: I74e7bf1755c265dbc309bb6c5a760f11643fd7ed Task-number: PYSIDE-441 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libshiboken: Recover from numpy import failuresFriedemann Kleint2017-12-211-3/+3
| | | | | | | | | | | | | | | | | | | | Clear the Python error on failure. Note that PyErr_Occurred() is not set for some reason in that case. Task-number: PYSIDE-580 Change-Id: I5672b9f5bf98e3d409abb4132f2face060826a0a Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-11-271-0/+32
|\| | | | | | | Change-Id: I79637555fbfbd596dee4313baf80149d03bb5206
| * Investigate the sporadic segfaults on RHELChristian Tismer2017-11-231-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lately, the RHEL platform tends to segfault between 0-4 times in a test run. I suspect that is related to some finalization code that is triggered at a special time, due to a stressy situation. But we don't know until we ask the CI system by printing a stack trace. This patch prints a stack dump after a segfault happened. The dump is only activated when the environment setting QTEST_ENVIRONMENT=ci is true. (The above needs to be compared with strcmp or strstr) Note that the tests _are not isolated_. I recognized that by the warnings module that leaked between tests. The processes are shared, unless you have setup and teardown functions. There might for instance be some hidden refcount bug that triggers only early enough in a stress situation. Change-Id: Ibbc592e7bdcbdd3cdbc06f203be3e5fc1daaf774 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-11-131-1/+1
|\| | | | | | | Change-Id: Ib0f638130d21a5619f239a9fb8beb7d92ad8d0e8
| * voidptr.cpp: Assign bool directlyFriedemann Kleint2017-11-071-1/+1
| | | | | | | | | | | | | | | | Fix MVC warning: voidptr.cpp(90): warning C4804: '>': unsafe use of type 'bool' in operation Change-Id: I690becd76320d843e79a56ea792b65fa4cc9a498 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-11-0614-1130/+565
|\| | | | | | | Change-Id: I72583df407fc5b3caa8bf35fd997889a4ac86512
| * Implement proper void pointer (void*) supportAlexandru Croitor2017-11-066-26/+524
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces a new type into the shiboken2 module which is imported by calling "import PySide2.support.VoidPtr". The type takes care of conversions from / to void* values in function signatures. Creating an instance can be done by passing either a shiboken wrapped object, or an integer representing an address, or a python object that implements the buffer interface. For example, this is useful for passing numpy arrays to C OpenGL functions that take void* parameters. First you convert the array into a bytestring (using numpy.array.tobytes(), then you instantiate a VoidPtr from that bytestring, and finally you pass it along to a GL function. One corner case that is currently not supported is void** parameters. Change-Id: I01e291d6856cb6bd8b5175adc3ead6b728036535 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * Remove dead / unused code regarding conversionsAlexandru Croitor2017-11-0212-1105/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a lot of code that was previously used for doing conversions between C++ / Python types (apparently relying on extensive RTTI / typeid manipulations), which got superseded by a cleaner templated approach. The old code was left behind, and there were a few instances where it was still used even though it wasn't needed, like in QtScript typesystem XML and shiboken's enum handling. Remove the old code, apply the small changes needed to make it work with new the code. This is cleanup to reduce the confusion regarding conversion behavior, and also preparation for a proper implementation of handling "void*" types. Change-Id: I8f16bb31436f9a677bb2d64c7197c4375005b656 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-10-277-10/+289
|\| | | | | | | Change-Id: I94cb5a7dab97cff3591bac534228bfd3e3ad5938
| * Support the qApp macro correctly, final version incl. debugChristian Tismer2017-10-275-5/+283
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For short the new features: - there is a qApp in QtCore, QtGui and QtWidgets for compatibility, and also in __builtins__ for a true macro-like experience. - if you delete any qApp variable, the Q*Application is reset and you can start over. Long description: There is a qApp macro in Qt5 which is equivalent to Q*Application.instance() . Python does not have macros. Both PyQt5 and PySide2 have an according structure in QtWidgets. In the case of PySide2, the qApp variable is first initialized to None and later to QApplication(). This does not reflect the original sense of the qApp macro, because - it only handles QApplication, - it does not handle destruction. This "macro" should live in QtCore, but both PyQt5 and PySide2 decided to put this in QtWidgets. As a compromize, I propose to put qApp into all three modules, and into __builtins__ as well, so wherever you create an application, you find this "macro" in place. While changing the code, I stumbled over the template set_qapp_parent_for_orphan. I tried to make sense out of it and finally removed it. There were no side effects but bug PYSIDE-85 is gone, now. With some extra effort, I created a singleton qApp that changes itself. This way, a true macro was simulated. Note that this was not possible with a garbage collected variable, and I had to make shiboken aware of this. As the final optimization, I turned qApp also into a fuse variable: Delete any qApp variable and Q*Application will finish when there is no extra reference. Task-number: PYSIDE-85 Task-number: PYSIDE-571 Change-Id: I7a56b19858f63349c98b95778759a6a6de856938 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * Fix the signature of the Q*Application constructorChristian Tismer2017-09-292-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Q*Application had PySequence as Parameter, although only QStringList is accepted. That resulted in an implausible error message when a list of, say, Integers was given. This patch - replaces PySequence by QStringList (one more tuple layer), - fixes QCoreApplication to give the same kind of error messages, - renames the shiboken function sequenceToArgcArgv to listToArgcArgv and changes it to only allow list descendents. We also changed signature.typing in one line to display List[str] correctly. I think this belongs more to PySide-331, a fixed qApp. Task-number: PYSIDE-510 Task-number: PYSIDE-331 Change-Id: Ib256c6a2db05a3db826454e1bf1b4729d59a240b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Signature: Remove pre 5.7 parts, fix coding styleFriedemann Kleint2017-09-291-1/+1
| | | | | | | | | | | | | | | | Complements 30a1c9c41e5e6d4166f171b9477c6f46cafa782f. Task-number: PYSIDE-510 Change-Id: I76e433dc35dbe88dbf254b19b82b8c392af0dad4 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-09-285-6/+726
|\| | | | | | | Change-Id: I47521e21977b1f17fcc65590f565270b2440a48b
| * Signature: buglet makes clang complainChristian Tismer2017-09-251-1/+1
| | | | | | | | | | | | | | Some small oversight is now an error after the last clang update. Change-Id: I61b118d772cacdf7950e3b43e76cc4351c3062f3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * Signature: fix documentationChristian Tismer2017-09-251-1/+4
| | | | | | | | | | | | | | | | There was some glitch that made a few sentences incomplete. Task-number: PYSIDE-510 Change-Id: Idd11c7a0d9f31aab4ab80e6fd6002f2320695ad5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * Implement introspection with __signature__ packageChristian Tismer2017-09-205-6/+723
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The signature module was turned into a package under 'PySide2/support/signature'. The package is completely isolated so that nothing is leaking into the normal import machinery. The package is also not initialized unless a __signature__ attribute is accessed. The only change to Python during a PySide run is the existence of the __signature__ attribute. As a side effect, all tests run at the same speed as before this extension. The module does not actively import PySide modules. Instead, it inspects sys.modules and reloads its mapping.py if needed. Example usage: >>> PySide2.QtWidgets.QGraphicsAnchorLayout.addAnchors.__signature__ >>> PySide2.QtWidgets.QGraphicsAnchorLayout.__signature__ The module has been thoroughly tested on macOS. I consider this ready. Task-number: PYSIDE-510 Change-Id: Ibb231a7fbb4ccc1a7249df55e3881a4e21a19c0d Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Add numpy supportFriedemann Kleint2017-08-033-3/+346
| | | | | | | | | | | | | | | | | | Add simple array converters giving access to NumPy arrays. Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: I2446b0f1ef98eaf12df95e4bd0e03d73e0cd7126 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | libshiboken: Add Array convertersFriedemann Kleint2017-08-038-1/+547
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a SbkArrayConverter struct which provides a list of check functions that return a converter function for an array of matching size. Add simple array converters for arrays of C++ primitive types. Instances of the ArrayHandle<>, Array2Handle<> templates will be generated which may point to internal data or allocated arrays. Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: I157606891fad345ccd7af6d4a9d4dcb0c634b2f4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-07-141-1/+1
|\| | | | | | | Change-Id: I1dd2958b252b82e8699e8d2212afdce0086a16d2
| * Improve suffix names for shared libraries and cmake config filesAlexandru Croitor2017-07-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change decouples the naming of general shared libraries, python module extensions, and cmake configuration files. All of them are now computed depending on the python version and python build configuration, and can also be manually set via CMake variables. The module extensions names now use the most detailed 'import' prefix, which usually informs whether a debug or release python was used, or the Python ABI flags (for Python >= 3.2). When a debug Python interpreter is used for building PySide2, the preprocessor define Py_Debug is now correctly propagated to PySide2 sources, which fixes previous crashes in debug builds. This affects only Linux and macOS builds. There is a subsequent change for making it work for Windows builds. All in all, this now allows proper mixing of debug / release versions of the Python interpreter with debug / release versions of PySide2 on Linux and macOS. Task-number: PYSIDE-508 Change-Id: I88a05c3ada0fb32c7c29bdb86d7a2c15acc963b8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Shiboken: Set C++ 11 globallyFriedemann Kleint2017-06-281-1/+0
| | | | | | | | | | Change-Id: I17634ebc245cae87819af16d79704326905e5783 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | [Reland] Fix crash on exit with debug Python 3Alexandru Croitor2017-06-271-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | Crash happens because of an use-after-free error. This is a bandaid fix transforming the crash into a memory leak. Proper fix will require more investigation and time. The commit was missing in 5.9 branch after repo merge. Task-number: PYSIDE-488 Change-Id: I56358573ca60d6f18fd85fbd7eb3eb0da8fbf163 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.9Friedemann Kleint2017-06-096-9/+18
|\| | | | | | | Change-Id: I73f39966a2af7aa935e1890e29c9b71573aae97c
| * libshiboken: Fix/Silence some MSVC warningsFriedemann Kleint2017-06-096-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | autodecref.h(110): warning C4522: 'Shiboken::AutoDecRef': multiple assignment operators specified autodecref.h(78): warning C4800: 'PyObject *const ': forcing value to bool 'true' or 'false' (performance warning) conversions.h(282): warning C4800: 'long': forcing value to bool 'true' or 'false' (performance warning) basewrapper.cpp(625): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) basewrapper.cpp(654): warning C4800: 'SpecialCastFunction': forcing value to bool 'true' or 'false' (performance warning) basewrapper.cpp(1014): warning C4800: 'Shiboken::ParentInfo *': forcing value to bool 'true' or 'false' (performance warning) basewrapper.cpp(1044): warning C4800: 'void *': forcing value to bool 'true' or 'false' (performance warning) helper.cpp(56): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data shibokenbuffer.cpp(46): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) Change-Id: If1517fde8e7670f258a56f6d845a66ebb3d82141 Reviewed-by: Christian Tismer <tismer@stackless.com>