aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken
Commit message (Collapse)AuthorAgeFilesLines
* Generate Hinting Stubs AutomaticallyChristian Tismer2018-12-032-49/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The script is now automatically called in the cmake build, as part of the create_pyside_module macro. The script runs after every module build and tries to generate .pyi files. This does not need to succeed, but will generate all files in the end. The script has been prepared to allow partial runs without overhead. After integration of the .pyi generation into cmake, these files are also installed into the install directory by cmake. For wheel building, setup.py has entries, too. Building a full project with all modules revealed a bug in the signature module that allowed unsupported function objects. Module enum_sig had to be changed to suppress types which have no ancestry in shiboken. PYTHONPATH was avoided because it was not Windows compatible. Instead, the script was changed to accept "--sys-path" and "--lib-path" parameters. The latter evaluates either to PATH or LD_LIBRARY_PATH. The necessity to create .pyi files while the project is in the build process showed a hard to track down error condition in PySide_BuildSignatureProps. Simple logging was added as a start of introducing logging everywhere. Task-number: PYSIDE-735 Change-Id: I6b3eec4b823d026583e902023badedeb06fe0961 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Split The Signature Module After The Project SplitChristian Tismer2018-11-244-32/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PySide project has been split into three pieces, including Shiboken. This had far-reaching consequences for the signature project. Shiboken can be run together with PySide or alone, with tests or without. In every configuration, the signature module has to work correctly. During tests, the shiboken binary also hides the shiboken module, and we had to use extra efforts to always guarantee the accessibility of all signature modules. This commit is the preparation for typeerrors implemented with the signature module. It has been split off because the splitting is not directly related, besides these unawaited consequences. I re-added and corrected voidptr_test and simplified the calls. Remark.. We should rename shiboken to Shiboken in all imports. I also simplified initialization. After "from PySide2 import QtCore", now a simple access like "type.__signature__" triggers initialization. Further, I removed all traces of "signature_loader" and allowed loading everything from PySide2.support.signature, again. The loader is now needed internally, only. Also, moved the type patching into FinishSignatureInitialization to support modules with no classes at all. The "testbinding" problem was finally identified as a name clash when the same function is also a signal. A further investigation showed that there exists also a regular PySide method with that problem. The test was extended to all methods, and it maps now all these cases to "{name}.overload". Updated the included typing27.py from https://pypi.org/project/typing/ from version 3.6.2 to version 3.6.6 . Task-number: PYSIDE-749 Change-Id: Ie33b8c6b0df5640212f8991539088593a041a05c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Improve enum type operations implementationCristian Maureira-Fredes2018-11-201-78/+79
| | | | | | | | | | | | | | | | | | | | | | | The current implementation of the enum operations, wrongly assumes that the first element is always an enum. This patch add some logic to determinate the types we are dealing with, to allow operations like: 2 + QtCore.Qt.Key.Key_1 which were not accepted before. Float numbers are not accepted for enum operations and a test case was included. Some tests were adapted since they were wrongly implemented. Fixes: PYSIDE-830 Change-Id: I407dca2b7c39fc684dbdac19ad45d259403ebadd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Update string treatment for VoidPtrCristian Maureira-Fredes2018-11-201-0/+8
| | | | | | | Task-number: PYSIDE-852 Change-Id: If1ff8407c7f9449be278869e91104372fa86790f Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add std::nullptr_t supportCristian Maureira-Fredes2018-11-193-1/+36
| | | | | | | | | | | | Shiboken did not have support for `nullptr_t` so the converter was failing when encountering a `nullptr`. A test case is included. Fixes: PYSIDE-854 Change-Id: If5aad245e7074ed791bfc7a42a4c6a56de441d5b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Signature: Implement Nested Classes and Functions for ShibokenChristian Tismer2018-11-151-263/+312
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch again contains a complete overhaul of the signature module. The code was re-implemented to properly support nested classes. Also, the code was reduced by AutoDecRef and by adopting a concise C++ style. Note.. We will add a shiboken signature test and complete mapping.py after the split into three projects is done. The split changes a lot and is needed right now! Signatures were quite complete for PySide, but the support for Shiboken was under-developed. Since we are planning to generally enhance error messages by using the Signature module, we should be able to rely on them to always produce a signature. Therefore, a general overhaul was needed to resolve all cornes cases for Python 2 and 3. Nested classes are supported, as well as plain module functions. The usage of the typing module might improve over time, but the Signature implementation is now considered complete. The loader will respect now the path settings which might not be the package dir but the build dir. This is more consistens with COIN testing. Task-number: PYSIDE-795 Change-Id: I246449d4df895dadf2bcb4d997eaa13d78463d9b Reviewed-by: Simo Fält <simo.falt@qt.io>
* License documentation: Fix file name of bufferproc headerFriedemann Kleint2018-11-141-1/+1
| | | | | | | | | | | A new version is now in use, causing: qtattributionsscannertorst.py:122: ".../sources/shiboken2/libshiboken/bufferprocs27.h" is not a file Change-Id: I14d9b9d8902ff7b3595b0e5b88d957a3847ecdae Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Friedemann Kleint2018-10-295-15/+20
|\ | | | | | | Change-Id: I3bb491686968e81382c135ab737da259d9796f52
| * Fix Memory Leak Caused By Wrong Limited API DefaultChristian Tismer2018-10-295-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a type has nullptr as tp_dealloc, there apply different defaults. Static types had object_dealloc as default, while new heaptypes created with type_new have subtype_dealloc as default. A problem was now that PyType_FromSpec also has subtype_dealloc as default. But that is wrong, because a type that was written with the static type approach is already written with object_dealloc in mind and takes somehow care about further issues with that type. When we now convert this type and suddenly use subtype_dealloc instead of object_dealloc, things get pretty wrong. Finding that out was pretty hard and took quite long to understand. The fix was then very easy and is the best proof: Replacing our former (wrong) solution of supplying an SbkDummyDealloc with a function object_dealloc works perfectly, and the leakage completely vanished. The documentation now is also corrected. Task-number: PYSIDE-832 Change-Id: Ifc20c28172eb5663cd5e60dac52e0a43acfb626c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into 5.12Friedemann Kleint2018-10-181-1/+1
|\| | | | | | | Change-Id: I2468031ecb8cc8a97bcb8ddf85e48101ec22eda9
| * Fix crash when using a MSVC debug buildFriedemann Kleint2018-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | The pointers of probe_tp_name and check->tp_name are different when using the MSVC debug runtime. Use strcmp() instead. Fixes: PYSIDE-835 Change-Id: I8b6735a9a407bf3325986edd61a7911964802a24 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Fix crash when garbage collecting in a non-GUI threadFriedemann Kleint2018-10-157-5/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a GUI class happens to be detected unreferenced when garbage collecting in a non-GUI thread and is subsequently deleted, crashes can occur for QWidgets and similar classes. The hitherto unimplemented delete-in-main-thread" attribute should be used. Add the missing implementation. Add the field to shiboken's type entry and SbkObjectTypePrivate class and pass it via newly introduced flags to introduceWrapperType(). Defer the deletion when invoked from the background thread and store the list of destructors in a list in binding manager run by Py_AddPendingCall(). Task-number: PYSIDE-743 Task-number: PYSIDE-810 Change-Id: Id4668a6a1e32392be9dcf1229e1e10c492b2a5f5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Prepare the Signature Module For More ApplicationsChristian Tismer2018-10-115-87/+246
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the preparation for a number of planned applications and extensions using the signature module. This general overhaul contains: - Extraction of signature enumerations into enum_sigs.py, - a list of current keyword errors in arguments which are unsolved in shiboken, but temporarily fixed in parser.py (too many for XML), - fix spurious duplications in multiple signatures - corrections for keyword errors in function names which cannot be fixed by Python (quite few), - fixing "..." arguments into "*args", - supporting the "slot wrapper" type. This is necessary for methods like "__add__", "__mul__" etc. - Create an extra function "get_signature" that has a parameter to modify the appearance, i.e. without self, without returntype, etc. Task-number: PYSIDE-510 Change-Id: If16f7bf02c6e7cbbdc970058bb630ea4db2b854a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Get Rid Of "register" Warnings In Python 2Christian Tismer2018-10-022-1/+29
| | | | | | | | | | | | | | | | | | | | | | The new clang compiler version complains when the "register" keyword is still used. This patch suppresses this warning for Python. The file "typespec.h" was corrected to include skbpython.h, too. This was found after a few warnings still did not vanish. Change-Id: I1e3299f071c6dffee4cb2596415bc195264d9a9b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | libshiboken: Remove left-over warnings pragmaFriedemann Kleint2018-09-251-4/+0
| | | | | | | | | | | | | | | | | | Remove left-over from f61be404a9e197af33e169d1e81afb8df3f0546e, fixing: shiboken2\autodecref.h(109): warning C4193: #pragma warning(pop): no matching '#pragma warning(push)' Change-Id: I82a2b8627cd88393436568e12839a1ae988ac0dc Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-09-211-3/+4
|\| | | | | | | Change-Id: Ie4320a6ac584ec47ed8eaca538453a8e5b123c42
| * Release Py_buffer after gets its underlying pointerBoxiang Sun2018-09-191-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | PyObject_GetBuffer will increment the reference of Py_buffer, when the buffer is no longer being used, we should call PyBuffer_Release to reduce the reference count. See https://docs.python.org/3/c-api/buffer.html#c.PyBuffer_Release Task-number: PYSIDE-140 Change-Id: Ia7c231aff317252db83b2405237031fc73af2651 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libshikoken: Refactor the Visitor class hierarchyFriedemann Kleint2018-09-192-93/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementing the deleteInMainThread feature requires being able to collect a list of destructors and potentially storing it. This requires splitting out the actual deallocation/destructor calls from the DtorCallerVisitor and DeallocVisitor classes. Since this is the only use of the virtual HierarchyVisitor::done() method (and it does not really belong to the visitor pattern), remove it. Change the void visit() method into a bool from which true can be returned to terminate. The finish()/wasFinished() methods can then also be removed from HierarchyVisitor and the code simplified accordingly. Replace the DtorCallerVisitor and DeallocVisitor classes by DtorAccumulatorVisitor that collects a list of DestructorEntry structs containing destructor function and C++ instance. Polish the code a bit, use member initialization, add override, move implementations to source and some spacing for clarity. Task-number: PYSIDE-810 Change-Id: I5e3ef6df753679ec111a5f0d1b75305bd5cf1c0c Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-09-122-3/+29
|\| | | | | | | Change-Id: Ie346fe7d7ac85ce0b82806904044680713375bf0
| * shiboken/pep384: Avoid warning by literal comparisonCristian Maureira-Fredes2018-09-121-1/+1
| | | | | | | | | | | | | | | | | | Even though we are certain of the comparison, better to get rid of the warnings. Change-Id: Iafa51b4c59c2315b24fc9092d18792f0c9297553 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
| * Automate Parsing COIN testresults for exists_{platf}_{version}_ci.pyChristian Tismer2018-09-101-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The extraction of exists_{platf}_{version}_ci.py has been done by editing the testresults of COIN test by hand. Since the beginning of the year, this has become tedious, because COIN now surrounds everything with time stamps. This script scans the whole website and extracts all such files. Creation of the generated python pages becomes really easy now. The initial scan takes below 30 minutes. Then it will only parse new URLs. Task-number: PYSIDE-510 Change-Id: I1273f8a77596ced16c7a3653c89736c3e1796540 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-09-042-3/+3
|\| | | | | | | Change-Id: Ie8025300580981c5349b31d4846a7f659481991d
| * libshiboken: Use empty() to check for empty containers as clang-tidy advisesFriedemann Kleint2018-08-302-3/+3
| | | | | | | | | | | | | | | | | | Using the size() method for that purpose can be expensive for standard containers. Task-number: PYSIDE-727 Change-Id: I0da34e271503384a741d856fff5e84fee67bc97f Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libshiboken: Replace AutoDecRef::operator= by a reset() methodFriedemann Kleint2018-08-311-17/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The operators cause compiler warnings about multiple versions and missing return types. Replace them by a reset() method (modeled after std::unique_ptr, QScopedPointer). This implies some changes in the templates. Change-Id: I21a8fb9b84ecdfecf9671fa113f1bb3c6483166f Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | libshiboken: Fix clang-tidy warnings about class definitionsFriedemann Kleint2018-08-318-17/+38
| | | | | | | | | | | | | | | | | | | | | | | | - Add override - Use = default for trivial constructors/destructors - Delete copy and move constructors/assignment and move assignment operators where not needed - Use member initialization and remove constructors from simple structs - Use explicit where applicable Change-Id: Id293dd0008b05243e665347f12fd1dee3b1b70f7 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | libshiboken: Fix remaining clang-tidy warningsFriedemann Kleint2018-08-304-10/+8
| | | | | | | | | | | | | | | | | | | | - Remove else after return/continue/break; unindent code or simplify return conditions - Fix C-style casts - Comment out unused parameter Change-Id: Iea1106023829658cd1ce005fa02d0c8940504dfd Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-08-292-77/+281
|\| | | | | | | Change-Id: I302543eef74bc1f3dc6340cdfab7510a66ea1b6a
| * Document the Signature ModuleChristian Tismer2018-08-272-61/+281
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The signature module is an extension that generates full introspection as a PySide feature. It is documented in detail to make it usable and extensible for other developers. Special care was taken about the interaction with the rest of the project, related code that is based upon this module, and the interaction with the COIN module. Task-number: PYSIDE-510 Change-Id: I7b3052da71a6fe3bd6d9cb8cc47443cdf976d3b0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * Make signature module unconditionalChristian Tismer2018-08-271-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | After the signature module has been around for quite a while, there is no longer a reason to leave it optional. At the same time, we set the minimum Python 3 version to 3.5 . Some comments are reworked as well, but nothing real changed. Task-number: PYSIDE-510 Change-Id: I9e960f390d507d24bb45f7028838755fe23e751d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-08-244-299/+813
|\| | | | | | | Change-Id: Ide71a89ef173d6f3e1fa6960f7b15f1fd6cc1bf1
| * Document the Python Limited APIChristian Tismer2018-08-212-291/+704
| | | | | | | | | | | | | | | | | | | | | | | | | | The Python Limited API brings certain restrictions to PySide. This document contains an overview and all relevant changes. Furthermore, there are appendices which show how the type transformation of the extended types was done and how it was verified.. Task-number: PYSIDE-768 Change-Id: Ifd6fd3740c23deaed65cce1ba12f17e5f093f18f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * Implement Proper Name ManglingChristian Tismer2018-08-213-8/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When types have attributes starting with two underscores but ending with at most one, Python uses name mangling to create a unique private variable. PySide needs to obey this rule in the tp_getattro methods. We implemented it as an optimized _Pep_PrivateMangle function that solves the problem internally without exposing the _Py_Mangle function. Remark: I think the exclusion of the _Py_Mangle function is another oversight in the Limited API. Task-number: PYSIDE-772 Change-Id: I0bfc2418dae439e963a16e37443f2099c6980696 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Limited API: remove the "slot_" workaroundChristian Tismer2018-08-233-31/+26
| | | | | | | | | | | | | | | | | | | | | | | | It has been a problem to compile the file "typespec.*" when using Python 2. For some reason, the name "slot" was not usable. I cannot find out what it was and how it vanished, but now I could remove the work-around without problems. Maybe it is due to some different includes which don't define some macros? Change-Id: If316c9c78a18cffcc5e4cac07610bd7f522db446 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | libshiboken: Undefine slots macros when including Python.hFriedemann Kleint2018-08-221-6/+22
| | | | | | | | | | | | | | | | Avoid potential clashes of Qt's "slots" macro when using compilers that support the push_macro pragmas. Change-Id: I33aaa7f4e11cb235344f3bfecd08b9d5ce434227 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-08-206-29/+16
|\| | | | | | | Change-Id: I5dd997d995feae2ddf207eb213fb08233dece77c
| * Fix Some Minor Limited API Omissions And QuirksChristian Tismer2018-08-066-29/+16
| | | | | | | | | | | | | | | | | | | | | | Some formatting was not ok, some ordering of methods was not perfect, some code vanished, bufferprocs had a bad filename, and descrobject.h did not need a patch, anymore since things were solved in signature.cpp . Task-number: PYSIDE-560 Change-Id: Ibd1bedf0763ebb3fbbfd33a8e7cff4b5af6fab5e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | libshiboken: Fix container typesFriedemann Kleint2018-07-315-84/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the ref count map to a unordered_multimap and the remaining lists to vectors. A linked std::list is not suitable for the lists used in libshiboken. Task-number: PYSIDE-727 Change-Id: Ibd65486a58cf43ac66b981bea65597df5a732b63 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | libshiboken: Refactor loopsFriedemann Kleint2018-07-304-100/+68
|/ | | | | | | | | | | Avoid repeated invocation of container.end() in the loop condition by either assigning to a variable or use range-based-for where possible. Use auto for iterators to allow for changing the container type. Task-number: PYSIDE-727 Change-Id: I5217207a3a7fb60823ccbcbf0915bf6cf21a3e4d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Pep 384 Final Cut: Remove PepTypeChristian Tismer2018-07-2310-70/+63
| | | | | | | | | | | | | | | | | | | | | | | | | While trying to document the Limited API Project, it suddenly struck me: We can make the patch much much simpler and implement it without the necessity to have an extra PepType! Now I am happy to continue the documentation, because it is now no more improvable. This version will last as long as the layout of PyTypeObject does not change substantially. When that happens, then we need to rewrite stuff with the according PyType_GetSlot() access functions. These access functions will until then be complete enough so that we can live without the tricks like inventing a reduced PyTypeObject as was done in the current implementation. Task-number: PYSIDE-560 Change-Id: I49849cc377baa6794a5b53292691e21d6e2853ab Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* 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>