aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
Commit message (Collapse)AuthorAgeFilesLines
* libshiboken: Take const SbkConverter/SbkObjectType * where appropriateFriedemann Kleint2017-03-284-53/+60
| | | | | Change-Id: I0597f4c4f2eb0e8d4979690eeb1f17d78cf4e619 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Improve the 'Value' type wrapper registrationPankaj Pandey2017-03-173-11/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit works around some bugs where multiple/incorrect wrappers were registered for some types: - In cases where the first field of a class was itself a Value type instance (instead of pointer), both the parent and child wrappers had same cptr address, causing confusion in retrieveWrapper. Previously, this was worked around by always creating a new wrapper for all Value type fields on every access, causing leaks. We now check for colocated child wrappers and return that instead of creating new wrapper, so each Value type subfield need only have one wrapper. - Some cases of incorrect wrapper registration due to an existing wrapper which shiboken could not figure being deleted are fixed, specifically cases where the newly registered wrapper is from object created in python or owns its wrapper. - Do not release incorrect wrapper in case of address reuse by checking that the registered wrapper is indeed the wrapper being released. Task-number: PYSIDE-217 Task-number: PYSIDE-224 Change-Id: I019c078566c4b9b90e63c5d991e2e372d39c632a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Remove memory leak in shibokenChristian Tismer2017-02-231-1/+2
| | | | | | | | | | | | | | | | | | There was a harder to find memory leak reported in early PySide 1 times which was still valid in PySide2. I used two scripts which were different by only one line and showed very different memory behavior. With valgrind, I ran both scripts in parallel, and after some tweaking, the valgrind logfiles of the two runs could be compared. The result was a clear indicator that some new call was never disposed of. It turned out that the error was a mis-placed ‘delete’ in basewrapper.cpp of shiboken2. Task-number: PYSIDE-205 Change-Id: I1897ec4e75e3ec887716bdbe0f4487176530e03c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libshiboken: Remove some C-style castsFriedemann Kleint2017-01-179-64/+70
| | | | | | | Replace by C++ casts. Change-Id: I20d88ff021c681e63a6a4328c3402308f8c188e5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libshiboken: Fix warning about using deprecated std::auto_ptrFriedemann Kleint2017-01-121-3/+3
| | | | | | | | Replace usage of auto_ptr by a delete statement, which also makes the intention of the code clearer. Change-Id: Ida69b8df00f6a86c43547f013c799b8ccd66f60d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* libshiboken: Header cleanupFriedemann Kleint2017-01-064-6/+11
| | | | | Change-Id: Idb7d588d5790d92139fcd7f629faf23be49ec527 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add additional numeric overflow checksAlexandru Croitor2016-12-221-39/+98
| | | | | | | | | | | | | | This patch addresses the missing overflow warnings for each assertRaises found in overflow_test.py and in implicitconv_numerical_test.py, specifically for the cases of big numbers that can't be represented in long long's. The patch doesn't cover all the possible cases, but the overflow checks should be more robust now, especially in cases when the overflows happened silently and returned -1 without showing any warnings. Change-Id: Ifded579f5c11d4ae78d91f63374dd62c8cbf953f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libshiboken: Output a warning when integer overflows occurFriedemann Kleint2016-12-161-9/+38
| | | | | | | | Output type and size. Change-Id: Id24fe755e3be9f8d2afe9c668dafe49ad6ec42c7 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use Python 3 API when converting unsigned long longFriedemann Kleint2016-12-152-0/+16
| | | | | | | | | | | | | | | | | | The existing code written for Python 2 wrongly detected large values of size_t as negative on Windows, causing TestShiboken::testWrapInstance() to fail: ERROR: testWrapInstance (__main__.TestShiboken) File "module_test.py", line 51, in testWrapInstance obj = shiboken.wrapInstance(addr, ObjectType) OverflowError Use the new API of Python 3 which takes care of checking for negative values. Task-number: PYSIDE-431 Change-Id: I16bee5385223a7baba81b112d800459becfd8df7 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libshiboken/basewrapper.cpp: Add more field initializersFriedemann Kleint2016-12-021-2/+6
| | | | | Change-Id: I4d38f0e3b308d4f314ba07ed7ccaed961e947f9e Reviewed-by: Christian Tismer <tismer@stackless.com>
* basewrapper.cpp: Fix definition of SbkObjectGetSetListFriedemann Kleint2016-12-021-3/+4
| | | | | | | | | | | | | | | | Fix the prototype of the getter SbkObjectGetDict and remove the C-style cast. Add missing fields to initialization PyGetSetDef SbkObjectGetSetList[] = Fixes warnings: libshiboken/basewrapper.cpp:126: Warnung: missing initializer for member 'PyGetSetDef::doc' [-Wmissing-field-initializers] libshiboken/basewrapper.cpp:126: Warnung: missing initializer for member 'PyGetSetDef::closure' [-Wmissing-field-initializers] libshiboken/basewrapper.cpp:126: Warnung: missing initializer for member 'PyGetSetDef::get' [-Wmissing-field-initializers] libshiboken/basewrapper.cpp:126: Warnung: missing initializer for member 'PyGetSetDef::set' [-Wmissing-field-initializers] ... Change-Id: I42a1d5010e282e07947cdc236f7eef2ef38aecb7 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libshiboken: Fix new []/delete mismatchFriedemann Kleint2016-12-021-1/+1
| | | | | | | | | | libshiboken/helper.cpp:135:9: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete] delete message; ^ libshiboken/helper.cpp:129:21: note: allocated with 'new[]' here Change-Id: I05618a679df618e898ce3c189372b4eeabb2d1f5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix some integer conversion warnings from MSVC 64bitFriedemann Kleint2016-11-234-11/+11
| | | | | | | | | | | | shiboken2\libshiboken\conversions.h(419): warning C4244: 'return': conversion from '__int64' to 'char', possible loss of data sbkconverter.cpp(372): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data sbkconverter.cpp(385): warning C4244: 'initializing': conversion from 'Py_ssize_t' to 'int', possible loss of data sbkconverter.cpp(521): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data typeresolver.cpp(100): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data typeresolver.cpp(142): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data Change-Id: Ib1d31ef8f53ecb50f21abd6da17ab31656b3653d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix warnings about missing field initializersFriedemann Kleint2016-11-111-3/+5
| | | | | | | | | | | | | | | sbkenum.cpp:268:1: warning: missing initializer for member 'PyGetSetDef::set' [-Wmissing-field-initializers] sbkenum.cpp:268:1: warning: missing initializer for member 'PyGetSetDef::doc' [-Wmissing-field-initializers] sbkenum.cpp:268:1: warning: missing initializer for member 'PyGetSetDef::closure' [-Wmissing-field-initializers] sbkenum.cpp:268:1: warning: missing initializer for member 'PyGetSetDef::get' [-Wmissing-field-initializers] sbkenum.cpp:268:1: warning: missing initializer for member 'PyGetSetDef::set' [-Wmissing-field-initializers] sbkenum.cpp:268:1: warning: missing initializer for member 'PyGetSetDef::doc' [-Wmissing-field-initializers] sbkenum.cpp:268:1: warning: missing initializer for member 'PyGetSetDef::closure' [-Wmissing-field-initializers] sbkenum.cpp:375:1: warning: missing initializer for member '_typeobject::tp_del' [-Wmissing-field-initializers] sbkenum.cpp:375:1: warning: missing initializer for member '_typeobject::tp_version_tag' [-Wmissing-field-initializers] Change-Id: I368696973621b145f716eb3a9187c72e8fb38fe5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix warnings about unused variablesFriedemann Kleint2016-11-104-11/+11
| | | | | Change-Id: I552e2ac4c7c844afcb432f29aae71b3a55e33ad5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Updated license headers of the libshiboken runtime libraryFriedemann Kleint2016-09-2336-756/+1368
| | | | | Change-Id: I579f9073dcaf16213bb506abb1eb1573bbc5590b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* sbkconverter.cpp: Output warnings when conversion functions are missingFriedemann Kleint2016-09-071-0/+16
| | | | | | | | Prevent crash, output a warning instead. Task-number: PYSIDE-346 Change-Id: Ieb63ca959442d650f54f3798aa8c5df45b3f57f5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Bundle of fixes and additions to CMakeThomas-Karl Pietrowski2016-01-161-1/+1
| | | | | | | | * USE_PYTHON3 got renamed to USE_PYTHON_VERSION -> This variable can be now used to set a specific version to build for. For example, if you like to build for 3.4.5 you can set "-DUSE_PYTHON_VERSION=3.4". * Adding a block for debugging all PYTHON* variables. Useful for hunting bugs. * Adding generation of a extension suffix for Linux. Can also be useful for WIN and MAC, when building for different Python versions, so try it out. * Renamed PYTHON_SUFFIX into PYTHON_EXTENSION_SUFFIX (!). This might break others work! This variable name is more selfexplaining, that's why I renamed it.
* huge change on project layout.Christian Tismer2015-09-211-5/+5
| | | | | | | | | | | The intention is to have PySide2 and Shiboken2 as project names, to allow for co-existence of PySide and PySide2. This is the first version that builds with these settings on OS X: $ python3 setup.py build --debug --no-examples --ignore-git --qmake=/usr/local/Cellar/qt5/5.5.0/bin/qmake --jobs=9 This is not yet tested.
* remove a name clash with bool, after QBool was replaced by bool in Qt5Christian Tismer2015-07-032-3/+4
|
* adjust certain headers from 'class' to 'struct' and remove hundreds of ↵Christian Tismer2015-06-271-2/+2
| | | | annoying warnings
* Return None for .name of enum if no name for value.John Ehresman2013-07-121-2/+7
| | | | | | | | | This fixes segfaults when trying to get the name of a dead key from a qt key event. Change-Id: Ie631e2245bca0a3fee8616854f6479d3dec0c2bb Reviewed-by: Roman Lacko <backup.rlacko@gmail.com> Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Decref reference to type objectJohn Ehresman2013-06-241-19/+19
| | | | | | | | A decref is needed if the type is not subclassed when an instance is deallocated Change-Id: I2c64d7cb5b726c5bf108c1cbc5283cf315a5f8e9 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Fix segfault when using shiboken.deleteJohn Ehresman2013-06-241-1/+11
| | | | | | | | When an object is deleted, invalidate / releaseWrapper needs to be called before cptr array is deleted. Change-Id: I82f71f569d5a0f52084fbe1cc3d7846e764c7ef6 Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Fix bug introduced when recursive_invalidate was added.John Cummings2013-06-241-5/+14
| | | | | | | | | | If a Python object is passed to recursive_invalidate and is a sequence, each item in the sequence is invalidated Add unit test for recursive invalidate of a sequence Change-Id: I70834f8e027bd17a04c0e443bc7d584d1fde26c1 Reviewed-by: John Ehresman <jpe@wingware.com> Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Prevent infinite recursion in invalidateJohn Ehresman2013-06-131-5/+15
| | | | | Change-Id: I8946a8572b608bf8ede211d270f797f135f8083a Reviewed-by: John Cummings <jcummings2@users.sf.net>
* Replaced Nokia copyrights in headerTeemu Kaukoranta2013-05-2836-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | Replaced old Nokia copyrights with Digia copyrights. Removed "All rights reserved" strings without leading copyrights were removed (for example, 'Copyright SomeCompany, all rights reserved remain untouched). Did NOT touch contact details, will change them later. Excluded folders that have '3rdparty' in path. Used command: find . -path '*/3rdparty/*' -prune -o -exec grep -ilI -E '.*Copyright.*Nokia.*' {} \; | tee >(xargs sed -i -r '1,10 s/([ \t#*]*)(.*Copyright.*Nokia.*)/ \1Copyright \(C\) 2013 Digia Plc and\/or its subsidiary\(-ies\)\./I') >(xargs sed -i -r '1,10 s/(^[ \t#*]*)(all rights reserved.*)/\1/I') This excludes binary files and retains whitespace and #* characters in the beginning of the edited lines. Change-Id: I0d49f991c3dbd45d804843f185714e8681bc6c51 Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com> Reviewed-by: Janne Anttila <janne.anttila@digia.com>
* Fix possible conflict with garbage collector.Robin Dunn2013-05-131-0/+17
| | | | | | | | | Ensure that the GC is no longer tracking object an object before starting to delete it. Since Shiboken's object deletion goes through several steps we need to ensure that the GC will not try to delete the same object. Change-Id: Ia3337c72204b0ebf524959e1c99fbef7c1a02249 Reviewed-by: John Ehresman <jpe@wingware.com>
* Fix possible crash at exit.Robin Dunn2013-05-081-3/+5
| | | | | | | The interpreter may already be finalized when it gets to ~BindingManager() so ensure that the interpreter is still valid before doing anything that could result in Python being called for a DECREF or etc. Change-Id: I8a68322f404a1dcaa9203923d6f699ed57e9d319 Reviewed-by: John Ehresman <jpe@wingware.com>
* Fix handling of unsigned long long and provide unittests.Sébastien Sablé2013-03-142-2/+24
| | | | | | Change-Id: I29674a2d758ebf4650e2fe26cdc2e663c0bae5c7 Reviewed-by: Sébastien Sablé <sable@users.sourceforge.net> Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
* Optionally assert on free'd pointer with a valid wrapper.John Ehresman2012-12-174-1/+230
| | | | | | | | | | Use a debug mode callback that's called every time free is called to detect wrappers that are still in the binding manager's map after the C++ object is deleted. When it's enabled 10+ of the PySide tests fail. Change-Id: I30a40d48f6c4560ff0a3755d61c26ea4c6dd2758 Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
* PYSIDE-83 Fix segfault calling shiboken.dump1.1.2Nathan Smith2012-07-041-9/+14
| | | | | | | | | | shiboken.dump would segfault when called on an object whose C++ object had been deleted or whose parent C++ object had been deleted. This now checks to see if the data pointers beneath the PyObject are NULL before printing data. Change-Id: I89763a3ca3a5d25fad4142ff924692cd232c9c40 Reviewed-by: Marcelo Lira <marcelo.lira@openbossa.org>
* Fix and test case for bug PYSIDE-72.Nathan Smith2012-07-041-1/+1
| | | | | | | | | | | | | | | | The address of the PyObject is used directly as the hash rather than a member of that object. This avoids segfaults when the C++ object has been deleted, rendering the child pointers NULL. Removed a test case verifying that hash(QObject()) != hash(QObject()) because they in fact can be equal. The first QObject dies and is reaped before the second QObject is created, meaning that the second QObject may be allocated at the same address as the first QObject, giving them both the same address. If a reference is held to the first object, though, then they will get different hash values. Change-Id: I116463f88b837726a98720bae36770d53b13f4ee Reviewed-by: Marcelo Lira <marcelo.lira@openbossa.org>
* Set a default hash function for all ObjectTypes.Hugo Parente Lima2012-05-032-0/+11
| | | | | | | | Fix bug PYSIDE-42 Change-Id: I1392374dcf0055309152082e674cc1e3e6472d4d Reviewed-by: Paulo Alcantara <paulo.alcantara@openbossa.org> Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
* Don't clear weakrefs if Python interpreter isn't running1.1.1Jason McCampbell (Enthought, Inc)2012-04-191-2/+7
| | | | | Change-Id: I51ba2fcf5f881abb38e9b69b115fb98c536e2146 Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
* Merge GeneratorRunner inside Shiboken.Hugo Parente Lima2012-03-092-3/+3
| | | | | | | | | | | | | | | | Conflicts: CMakeLists.txt data/CMakeLists.txt doc/CMakeLists.txt doc/_templates/index.html doc/_templates/layout.html doc/_themes/pysidedocs/static/pysidedocs.css doc/commandlineoptions.rst doc/conf.py.in doc/contents.rst doc/images/bindinggen-development.png doc/images/boostqtarch.png tests/CMakeLists.txt
* Fix BUG #1097 - "QtGui.QShortcut.setKey requires QKeySequence"Paulo Alcantara2012-03-081-15/+16
| | | | | | | | | | | | | | E.g., when calling QtGui.QShortcut.setKey(QtCore.Qt.CTRL + QtCore.Qt.Key_Delete) it was being called as QtGui.QShortcut.setKey(long) (in Python 2) when it should be actually QtGui.QShortcut.setKey(int). So that resulted in a TypeError exception when using Python version 2 with that small code. See http://bugs.pyside.org/show_bug.cgi?id=1097. Signed-off-by: Paulo Alcantara <pcacjr@gmail.com> Reviewed-by: Marcelo Lira <marcelo.lira@openbossa.org> Reviewed-by: Hugo Parente Lima <hugo.pl@gmail.com>
* Fixed/refactored Shiboken::warning function.Marcelo Lira2012-03-082-9/+8
|
* Fixed CMake configuration of sbkversion.h header.Marcelo Lira2012-03-081-1/+2
|
* Added a convenience method to check if a converter belongs to a wrapper type.Marcelo Lira2012-03-082-0/+8
|
* Added adapter class SpecificConverter to provide type conversion based on a ↵Marcelo Lira2012-03-082-12/+84
| | | | | | | given string. Also added code to register a couple of type conversions by name, a bunch of related tests, and some fixes to the converter functions.
* Added a "to Python" converter function that gets a SbkConverter object.Marcelo Lira2012-03-082-3/+9
|
* Added some setting and converting functions to the new converter's API.Marcelo Lira2012-03-082-6/+40
|
* Added functions to the new converters API to check if a type is value or object.Marcelo Lira2012-03-086-5/+23
| | | | Comes with unit tests.
* Register type converters by name.Marcelo Lira2012-03-083-6/+27
| | | | This way they can be queried as the soon-to-be-deprecated TypeResolvers.
* Make converter branch work on a Python3.2 setup.Hugo Parente Lima2012-03-085-20/+41
|
* Fixes SBK_CONVERTER macro and SbkEnumType structure.Marcelo Lira2012-03-082-3/+6
| | | | | Fixes provided by Hugo Parente Lima. Unit test added.
* New converters for C++ enum and qflags types.Marcelo Lira2012-03-082-0/+18
| | | | Also removed a lot of unused and commented code.
* Added SBK_CONVERTER, a macro to get the type converter whatever the type, ↵Hugo Parente Lima2012-03-083-10/+3
| | | | but primitive types.
* Stores C++ enum type names on enum types itself instead of yet another hash.Hugo Parente Lima2012-03-081-18/+12
|