diff options
author | Christian Tismer <tismer@stackless.com> | 2018-07-14 15:10:56 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2018-11-24 10:31:02 +0000 |
commit | b92fb6e81be252a2ffae26768434028c5029ddc7 (patch) | |
tree | 88338bea02faff38ac986ba9d39c24d17670f795 /sources/shiboken2/libshiboken/pep384impl.cpp | |
parent | 4413f505ebcc39882ab7052488b37e38300b5219 (diff) |
Split The Signature Module After The Project Split
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>
Diffstat (limited to 'sources/shiboken2/libshiboken/pep384impl.cpp')
-rw-r--r-- | sources/shiboken2/libshiboken/pep384impl.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp index 869d09529..7cca03c84 100644 --- a/sources/shiboken2/libshiboken/pep384impl.cpp +++ b/sources/shiboken2/libshiboken/pep384impl.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ #include "pep384impl.h" -#include <autodecref.h> +#include "autodecref.h" extern "C" { @@ -502,7 +502,8 @@ static PyTypeObject *getFunctionType(void) PyTypeObject *PepStaticMethod_TypePtr = NULL; -static PyTypeObject *getStaticMethodType(void) +static PyTypeObject * +getStaticMethodType(void) { // this works for Python 3, only // "StaticMethodType = type(str.__dict__['maketrans'])\n"; @@ -511,12 +512,31 @@ static PyTypeObject *getStaticMethodType(void) "StaticMethod_Type = type(spamlist.__dict__['staticmeth'])\n"; return (PyTypeObject *) PepRun_GetResult(prog, "StaticMethod_Type"); } + +typedef struct { + PyObject_HEAD + PyObject *sm_callable; + PyObject *sm_dict; +} staticmethod; + +PyObject * +PyStaticMethod_New(PyObject *callable) +{ + staticmethod *sm = (staticmethod *) + PyType_GenericAlloc(PepStaticMethod_TypePtr, 0); + if (sm != NULL) { + Py_INCREF(callable); + sm->sm_callable = callable; + } + return (PyObject *)sm; +} #endif // Py_LIMITED_API #if PY_VERSION_HEX < 0x03000000 PyTypeObject *PepMethodDescr_TypePtr = NULL; -static PyTypeObject *getMethodDescrType(void) +static PyTypeObject * +getMethodDescrType(void) { static const char prog[] = "MethodDescr_Type = type(str.split)\n"; |