| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After the project split, shiboken exposed its own modules, and the
overall structure with shiboken2.support.signature and
PySide2.support.signature was already quite complicated.
When introducing embedding, it is necessary to have some support
folder that gets unpacked from a zipfile. That means, the shiboken2
root directory would be in the zip file in the embedding case.
This does not only increase the complexity, it further means
that we must make shiboken2.so available in the shiboken2
containing zipfile!
In order to avoid that, we stop the dependency from the two
support directories and use shibokensupport, instead. The
simplification of the loader and other modules is also significant.
Task-number: PYSIDE-510
Change-Id: Ic735a8d36f10f03698378f2ac9685a5955e40b0c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
VoidPtr:
Add toBytes() method that return a char* representation
of the void* pointer.
QByteArray:
The current implementation only provided the Buffer Protocol
for Python2, this patch includes the getbuffer implementation
for Python3.
Having a BufferProtocol implementation for Python3 allows the
initialization of VoidPtr to get access to the internal content,
so one can go back and forward with the representation of it:
ba = QByteArray(b"Hello World")
vp = VoidPtr(ba, ba.size())
vp.toBytes() # b"Hello World"
The BufferProtocol was also changed for Python2 including the new
buffer protocol (Py_TPFLAGS_HAVE_NEWBUFFER) function `bf_getbuffer`.
A test case was included.
Fixes: PYSIDE-934
Change-Id: I8936966da91b2dcc879c582cfc35e6a35f7a60b6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
| |
Strip the module names.
Change-Id: I7b123acc30e15e0954fe88f3a5b677e9aa736732
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
| |
Add a deprecation note to deprecated functions and classes.
There is a standard deprecated directive, but it takes the version
as a mandatory parameter, which we are unable to obtain from Clang.
Change-Id: Ice27b297fbd86def41d99b0f3505551ed301077f
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace the note directive previously used for \since by the standard
versionadd directive which takes less space.
Move it below the function parameters and indent it along with the
parameters correctly as otherwise the formatting is messed up.
Change writeFunctionSignature() to return a QString which is more
convenient for indenting.
Remove the bool writeDoc parameter from
QtDocGenerator::writeFunction() and spell out the formatting in
writeConstructors() since it all needs to be indented properly (using
the new indenter helper).
Change-Id: I2294ba457ed05f431be295f9d42489aeb6805a8a
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Move it to a separate header and turn it into a non-type template with
a tabWidth parameter to make it possible to use it with arbitrary tab
widths.
Turn it into a non-type template taking the tab width.
Change-Id: Ib2b6a7379ce66d1a22e73b4cb6a4a9a9b457014d
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
After the bug found in PYSIDE-928, the contextlib problem of
Python 3.5 also vanished.
What remains is the crash on shutdown which is caused by
module 'testbinding'.
Task-number: PYSIDE-953
Change-Id: I07f18fa468fdb0758ee4e4b7663c3a42bec42822
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was a bug in the signature function 'GetClassOfFunc' since last
November (sha1 2533dab013455bf94da2d4766e54abaf4d735e1e).
A type was returned without Py_INCREF. That happens because types are often
looked up, only, but here a normal return needed a ref.
Change-Id: I3e0956b341d2b0753da2e33dd9f557b6a693098d
Fixes: PYSIDE-928
Fixes: PYSIDE-937
Fixes: PYSIDE-943
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Array modifications did not work in template specializations (like
typedef QGenericMatrix<2,2,int> QMatrix2x2> causing warnings like:
There's no user provided way (conversion rule, argument removal, custom code, etc) to handle the primitive type
'const float *' of argument 1 in function 'QMatrix2x2::QMatrix2x2(const float * values)'.
Rewrite the array modification code to operate on AbstractMetaType
only instead of requiring code model data types and add the missing
handling to AbstractMetaBuilderPrivate::inheritTemplate().
Add a test.
Note that the warning was fixed by another change removing the array
modification since it did not take effect due to the presence of a
manually added PySequence constructor.
Change-Id: Ie4a1092fbef7237f8858790a74e2f75070ef6586
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the typesystem parser, add the allow-thread attribute to root and
complex type entry.
Rewrite the handling of allow-thread (cached) in AbstractMetaFunction
similar to the exception handling (store the modification in
AbstractMetaFunction and go down the class hierarchy if it is
unspecified).
Change-Id: I00e6e2ab25208fda63ec20522814cbfccbb8c42d
Fixes: PYSIDE-931
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Class-level exception specifications on a base class were not working
so far. This requires a larger refactoring, since the base classes are
not yet known at the point where class functions were traversed
(AbstractMetaBuilder::setupInheritance() is called at a later stage).
To fix this, store the actual type system modification in the
AbstractMetaFunction and move the logic determining whether to
generate exception handling into
AbstractMetaFunction::generateExceptionHandling(). In this function,
recurse down the base classes if the function does not have a
modification set.
This is a preparation for giving the allow-thread attribute, which can
currently only be used at a function level, a similar handling.
Task-number: PYSIDE-62
Change-Id: I28597559511d330cf860c6f6e21ffea229bfab3e
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Turn the test into a data driven test to also test modifications to
the class and typesystem level and test more cases, for example
overriding modifications on a higher level.
This is a preparation for giving the allow-thread attribute, which can
currently only be used at a function level, a similar handling.
Task-number: PYSIDE-62
Task-number: PYSIDE-931
Change-Id: Id5fe65b7d0edb4279b47aaa6e59dfb6cda2d75a3
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
| |
While converting smart pointers do not initialize the object with
default/minimal constructor.
Change-Id: Ie9400d8487accc0c90b0f0b31b855038ae698b5c
Task-Id: PYSIDE-947
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Python 3.5 has a bug that crashes the build.
See the description in the issue tracker.
The cure is to use a more recent contextlib.py and to avoid
a PySide cleanup function that creates the crash.
The problem is not solved for Python 3.5, and it is not clear
if the testbinding module has a hidden bug, too.
But this fix seems to be good enough for the moment.
We should decide if we are going to fix Python 3.5 or abandon
it altogether.
Change-Id: Iacf2237de1f34d2b3cd1d68f1fb5833bdca3fdc2
Fixes: PYSIDE-953
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The signature module tries to figure out if it has to act upon
functions by examining their type.
It was too specific to check for PyCFunction, directly. A user
had built a subclass of PyCFunction and used it with 'inspect.signature',
which then revealed wrong behavior.
This patch removes that restriction.
Change-Id: I7e126ce5750ec5c308cbd1bd1bc4ca4d5eb51e17
Fixes: PYSIDE-950
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Attempts to load the module directly from Python if loading it manually from
the .py file fails. This exposes the support submodule to installers. The
loader.py module was also patched to allow direct import from installers.
Change-Id: If225ae7a2e916912a581e09d1a02c18fd3a17526
Fixes: PYSIDE-942
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
| |
Use the cppName when looking for metatype while generating smart
pointer getter function
Change-Id: Ib3a632dd7f667a6bf7c487cfb673f0e55cbddde9
Fixes: PYSIDE-948
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
| |
Always generate QT_WARNING_DISABLE_DEPRECATED into Qt wrappers,
silencing any deprecation warnings.
Change-Id: I621ee357e6eddaee52dbb8ea12fe6dee8b588bec
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
type(QtWidgets.QWidget).__new__(type(QtWidgets.QWidget), "", (), {})
gave a problem in Python 2.7 after transition to PEP 384.
The reason for the problem is a check in Python 2.7 that tries to find
out if the function used to create a new object is a secure (builtin)
one. Therefore, all new types that are generated by a Python function
are filtered out. Unfortunately, Python 2.7 did that assuming that
only Python classes are heap types.
This is at least no longer true since Python 3 migrated to the new
type API where all new types are heap types.
The internal check was therefore changed to do the test for a builtin
"new" function differently. But not in Python 2.7 .
The workaround was to create the Shiboken.ObjectType as a heap type
and then remove that flag from the type. This seems to have no bad
effects, probably because the types did barely change when doing the
transition. Anyway, I will stay tuned and watch out if this later
creates a problem.
Task-number: PYSIDE-816
Change-Id: Ia596716b0e5dff3f1a7155ab6765186ef0b9d179
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ownership is always set recursively, so for each
element we check the children of the object.
When we don't have any, and also no parent
the mechanism we have fails, so for constructors
that allow having a null parent, we need to just
skip this function.
Change-Id: Iee6a81409cad7dd08c6ecbafd1b11c9a7bb0db85
Fixes: PYSIDE-922
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a CMake super project that includes the shiboken2, PySide2 and
pyside2-tools subprojects, so that it's possible to build everything
from Qt Creator (or any other IDE that supports CMake)
with minimal set up effort, and thus inform the IDE CMake integration
of all relevant files, for easier code editing, navigation and
refactoring.
This also lays the foundation for allowing 3rd parties to use the
shiboken2 generator to generate custom modules. This is
achieved by eliminating various hardcoded paths for libraries and
include directories.
Start using CMake targets throughout the build code to correctly
propagate link flags and include dirs for libshiboken and
shiboken2 executable targets. Same for the libpyside target.
Generate two separate cmake config files (build-tree / install-tree)
that can be used with find_package(Shiboken2), to make sure that
the PySide2 project can be built as part of the super project build.
This is currently the only way I've found to allow the super build
to work.
Note that for the build-tree find_package() to work, the
CMAKE_MODULE_PATH has to be adjusted in the super project file.
The generated config files contain variables and logic that allow
usage of the installed shiboken package in downstream projects
(PySide2). This involves things like getting the includes and
libraries for the currently found python interpreter, the shiboken
build type (release or debug), was shiboken built with limited
api support, etc.
Generate 2 separate (build-tree and install-tree) config files
for PySide2, similar to how it's done for the shiboken case, for
pyside2-tools to build correctly.
Install shiboken2 target files using install(EXPORT)
to allow building PySide2 with an installed Shiboken2 package
(as opposed to one that is built as part of the super project).
Same with PySide2 targets for pyside2-tools subproject.
Make sure not to redefine uninstall targets if they are already
defined.
Add a --shorter-paths setup.py option, which would be used by
the Windows CI, to circumvent creating paths that are too long,
and thus avoiding build issues.
Output the build characteristics / classifiers into the generated
build_history/YYYY-MM-DD_AAAAAA/build_dir.txt file, so it can be
used by the test runner to properly filter out blacklisted
tests. This was necessary due to the shorter paths options.
Fix various issues regarding target includes and library
dependencies.
Remove certain duplicated cmake code (like limited api check and build
type checks) in PySide2, given that that information will now be
present in the exported shiboken2 config file.
Include a short README.cmake.md file that describes how to build
the super project.
References used
https://rix0r.nl/blog/2015/08/13/cmake-guide/
https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/
https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1
https://cliutils.gitlab.io/modern-cmake/chapters/basics/functions.html
https://cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html
https://github.com/ComicSansMS/libstratcom/blob/master/CMakeLists.txt
Abandoned approach using ExternalProject references:
https://cmake.org/cmake/help/latest/module/ExternalProject.html
https://stackoverflow.com/questions/44990964/how-to-perform-cmakefind-package-at-build-stage-only
Fixes: PYSIDE-919
Change-Id: Iaa15d20b279a04c5e16ce2795d03f912bc44a389
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
| |
Probably a leftover from the old days.
Change-Id: I3e165faa66632a4387733a0dbdb0ddaca601035f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The correction to container types has a small bug which
does not exist in reality, but could give a problem in the
future:
- We need not only avoid instantiation in Missing, but
generally in all _NotCalled classes. Otherwise, when called
during processing of container types, they would loose
their (Missing, Default, ...whatever) tag.
Change-Id: I4eb154100da6f3067b816c190af314b2a710ff39
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix warnings appearing in Qt 5.13:
sources/shiboken2/generator/shiboken2/shibokengenerator.cpp:873:25: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations]
sources/shiboken2/generator/shiboken2/shibokengenerator.cpp:873:25: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations]
sources/shiboken2/generator/shiboken2/shibokengenerator.cpp:880:25: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations]
sources/shiboken2/generator/shiboken2/shibokengenerator.cpp:880:25: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations]
sources/shiboken2/generator/shiboken2/cppgenerator.cpp:5060:34: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations]
sources/shiboken2/generator/shiboken2/cppgenerator.cpp:5060:34: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations]
Change-Id: I7c938df64babf824b58bf5c785b281a88d5111db
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix warnings occurring in 5.13:
sources/shiboken2/ApiExtractor/abstractmetalang.cpp:1431:66: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = AbstractMetaFunction**; LessThan = bool (*)(AbstractMetaFunction*, AbstractMetaFunction*)]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
sources/shiboken2/generator/shiboken2/cppgenerator.cpp:358:43: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = Include*]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
sources/shiboken2/generator/shiboken2/cppgenerator.cpp:1683:55: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = QList<QString>::iterator]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
sources/shiboken2/generator/shiboken2/cppgenerator.cpp:5500:53: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = Include*]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:1585:65: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = AbstractMetaFunction**; LessThan = bool (*)(const AbstractMetaFunction*, const AbstractMetaFunction*)]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:1681:24: warning: ‘void qSort(Container&) [with Container = QStringList]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:2054:25: warning: ‘void qSort(Container&) [with Container = QStringList]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
Change-Id: If6940941ac31327597ce362a31b27773f4d5b94c
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An error was reported that we had a bug in this .pyi line:
def parseErrors(self) -> PySide2.QtScxml.QScxmlError: ...
which actually had to be a list like
def parseErrors(self) -> typing.List[PySide2.QtScxml.QScxmlError]: ...
A deeper look revealed that we had very many other examples,
also in the argument lists, were we did not handle containers
properly. (For example, 90 times in QtCore!)
This is a leftover from the type error messages which
were generated in C++, and never really understood.
This is now a clean rewrite of the C++ part to expose all
information and an extension of the Python parser that
systematically uses the container types from the typing
module.
The implementation became a bit more complex because of
Python 2: We need to provide our own copy of the public
typing module, because it is not safe to assume that this module
can be loaded. Importing it from support.signature gave a
problem because we now need to find the names of instances
to produce List[...], which needed to be implemented in the
loader.
Implemented the "Pair" type now as a native generic type.
This is more correct than the former implementation and
shorter in the .pyi files.
Additionally, an own definition of "Char" was provided for
brevity. This was not important to implement and could also
be done with "int", but it is helpful for the future to know how
to implement own types (and it was fun).
Task-number: PYSIDE-921
Task-number: PYSIDE-795
Change-Id: I0e565b38d7b4fff39dd606950f9f8d97c45acbf5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
| |
Add #ifdefs, fixing:
sources/shiboken2/libshiboken/pep384impl.cpp:413:1: warning: ‘PyObject* PepRun_GetResult(const char*, const char*)’ defined but not used [-Wunused-function]
PepRun_GetResult(const char *command, const char *resvar)
Change-Id: I5e469d6a24e95a602b882adbaad334a4ecf9af23
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PySide functions are quite uniquely formatted:
- There comes some header
- Then an opening brace to the very left
- Then body text
- Then a closing brace.
This structure is very quickly parsable with a single regular
expression, except:
There is a single case where the structure is different.
We remove that to save complexity in evaluation tools.
Task-number: PYSIDE-803
Change-Id: If868eb4b6a6e0d62ed2f944aeb9227a3bc459458
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
| |
Fix warnings in case Qt is not built with SCTP:
qt.shiboken: (network) type 'QSctpServer' is specified in typesystem, but not defined. This could potentially lead to compilation errors.
qt.shiboken: (network) type 'QSctpSocket' is specified in typesystem, but not defined. This could potentially lead to compilation errors.
Change-Id: I0352e34011f2123e08fe3330a53dcdadc468d6a9
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
| |
Next release out 5.12 branch will be 5.12.2
Change-Id: Ib2d6d2dcf60d5568699b06a299f3261d23cd6ebd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Pass the "deprecated" annotation from Clang into the meta language and
reject functions based on it when the the command line option
--skip-deprecated is set.
By default, have Python output a deprecation warning when a deprecated
function is called (which is visible when passing -Wd).
Task-number: PYSIDE-487
Change-Id: Ic28d82963fde11f258b2559b562d3f24017fe98d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ShibokenGenerator::isValueTypeWithCopyConstructorOnly()
returned false for QWebEngineHistoryItem since the check
for AbstractMetaAttributes::HasRejectedConstructor triggered
on WebEngineHistoryItem(QWebEngineHistoryItemPrivate *priv),
causing the function to bail out.
To prevent this, add a new
AbstractMetaAttributes::HasRejectedDefaultConstructor attribute
and use that in isValueTypeWithCopyConstructorOnly().
Task-number: PYSIDE-906
Change-Id: I4fee83b89f0a4c44e7e8d69e118ed7f2b03ceee1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
|
|
| |
Fix warning:
qsignalblocker_wrapper.cpp:110:9: warning: unused variable ‘numArgs’ [-Wunused-variable]
int numArgs = PyTuple_GET_SIZE(args);
Change-Id: Iad56d7b5218851df2ddf5cd68bfbddc8efcf83e0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The signature module will be used to generate automated
documentation by using the function signatures as docstrings.
This functionality should be low-hanging fruit. Actually, it was a
bit tricky to get this working. The crucial point was to use
PyType_Modified().
The function works fine on methods.
Supporting types needs some more effort.
It is not clear why the __signature__ attribute can be added,
but the change to __doc__ is not recognized. May be related to
the absence of Py_TPFLAGS_HAVE_VERSION_TAG ?
This will be addressed another time.
Task-number: PYSIDE-908
Change-Id: If8faa87927899f4c072d42b91eafd8f7658c6abc
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
| |
cppgenerator.cpp:2698:107: warning: format not a string literal and no format arguments [-Wformat-security]
Change-Id: I41d976749023bda142b680930f2d54d00687eb47
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
| |
Change-Id: I9539c1a4e24e915d5b356afafbd902266d493b5a
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
| |
Change the tp_func handling such that "" means nullptr and introduce a
formatter class for the entries to use nullptr and change the C-style
casts to reinterpret_cast.
Change-Id: I36a1a218d003035f23ab9f8d31c7a993379e23c2
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For the case of the method `addAxis` in the QPolarChart class,
the generated code evaluates first the inherited method:
QChart::addAxis(QtCharts::QAbstractAxis*,QFlags<Qt::AlignmentFlag>)
instead of the same class method:
QPolarChart::addAxis(QtCharts::QAbstractAxis*,QtCharts::QPolarChart::PolarOrientation)
The condition to check if an argument was a `QFlags<Qt::AlignmentFlag>`,
was just `PyNumber_Check(...)`, which was too broad, and then any
Enum would pass that condition.
The change was to include an additional condition to check the
type of the EnumType that was passed as argument.
Change-Id: I2eebb6f05c097d170a6d61633698444f03f20b02
Fixes: PYSIDE-898
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
| |
Change-Id: I96e3bff8a48f0bd5ea98c33a22ff12c31b01357d
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace in comments, code and generated code.
Rename variable NULL_VALUE to NULL_PTR and make extern for follow-up
changes.
Rewrite code using NULL in QString::arg() (resulting apparently from
some misunderstanding that it requires a terminating nullptr) to use
printf-formatting to fix a warning: format not a string literal and no
format arguments [-Wformat-security]).
Change-Id: I97c111cadc09192132308924136eb6ede7a6bf44
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
| |
Task-number: PYSIDE-903
Change-Id: I4dc2cce4741c87e08b8b3d0dc911c62d044ee054
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The TypeError messages can now be produced, based upon the
signature module.
As a feature under test, we produce ValueErrors instead in
certain cases. This will probably improve, later.
We are currently investigating how much can be determined,
automatically.
Task-number: PYSIDE-795
Change-Id: Ie8a648beaf8a3bed388e3c01ba501bb36859722e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
| |
The code was needlessly convoluted and generated ugly C-style casts
for wrapper classes. Factor out a function to write the assignment.
Change-Id: I2bc4b258f254d36a1a22f68336c285e64df0aca1
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When building type hints during the PySide build, it can happen that
the QtMultimedia module already exists, but the QtMultimediaWidgets
module is not yet built.
Since during the build also directories exist alongside with the not yet
existing modules, it can happen that such a directory is picked up by
Python 3, which supports namespace modules without __init__.py .
This case was already handled by the mapping modules, but
QtMultimediaWidgets was directly imported and not checked.
Now the check code has been extracted from the mapping reloader,
and there is no more unchecked module left.
Task-number: PYSIDE-735
Change-Id: I1a1f53525417651005d0759e417082fe71b02773
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Use METH_STATIC only when there are no instance methods in the same class.
Unearthed by a clash of QPlainTextEdit::find() and static QWidget::find(WId).
Change-Id: I891c678e004a0abc3937437b0cac26e8094853de
Fixes: PYSIDE-886
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the <class>_PTR_CppToPython_<class> converter function (written by
CppGenerator::writeConverterFunctions()), the generated code
used typeid(*ptr).name() to retrieve the name to use for the
SbkObjectTypes. This construct returns the name of the outermost
class (for example, "QWidget" for a QWidget-type paint device returned
by QPainter::device()), as opposed to "QPaintDevice *" returned by
typeid(ptr).name(). This caused a crash with multiple inheritance
since QWidget inherits QObject and QPaintDevice and the "QWidget"
type was associated with the QPaintDevice pointer.
To fix this:
- Add API to libshiboken to obtain the SbkObjectType* by name
and check for the presence of a special cast function (multiple
inheritance).
- Generate the code of <class>_PTR_CppToPython_<class> as follows:
Check whether the outermost type obtained by typeid(*ptr).name()
has a special cast function. If that is the case, use the
type name obtained by typeid(ptr).name() (base class) to create
the wrapper.
Change-Id: I8ee6b4c084e9dafa434623433661809b83aedee5
Fixes: PYSIDE-868
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
| |
Add 'static' and class name.
Task-number: PYSIDE-886
Change-Id: Ie70d3b405e034f6203c54a363e3037c83720af00
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The signature module has been quite far developed.
In the course of making things fit for the TypeErrors with
the signature module, now also all signatures from all
shiboken modules are queried.
Instead of writing an extra signature existence test for
shiboken, it made more sense to extend the existing
init_platform.py by the shiboken modules.
In fact, by this query a corner case was exploited that
worked on Python 2 but assertion-crashed on Python 3.
The mapping.py modules were also completed to support
all new PySide2 modules.
Special care had to be taken because the "shiboken2" module
exists both as directory and as binary module. The fix was
tricky, and I will add a task that replaces such workarounds
by a better design.
Task-number: PYSIDE-510
Change-Id: Ibf8e322d1905976a0044a702ea178b7f98629fb4
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
| |
Change-Id: Id54e27c36b7c6f6685013ae01d90ba4ae8e72457
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
|
| |
It should abort as it will usually result in broken code.
Change-Id: I81d930c4516b0ee97dec985525fab8140fdce3dc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|