diff options
author | Christian Tismer <tismer@stackless.com> | 2019-08-12 18:12:20 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2019-08-14 18:33:16 +0200 |
commit | c6f6b4ef3318ab55b53384856b948d428a24f313 (patch) | |
tree | c8444a9616003691ca5f8704fdabefc30ff91dfe | |
parent | 95d71006c3218dde732a6c231ade29460b13a0e7 (diff) |
Make signatures even more writable
When implementing QtCore.Slot.__signature__, the following
extension to writable signatures became useful:
Signatures were corrected to be writable if they were not set
by the signature module at all. But we should also allow
assignment when the signature was set to None.
This feature is only used for exploration; the correct way to
implement a new signature is to integrate it into the normal
generation process, as being done for QtCore.Slot.__signature__.
Change-Id: I010e505a376993f27c46bd1c14e327e44d375abd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | sources/shiboken2/libshiboken/signature.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sources/shiboken2/libshiboken/signature.cpp b/sources/shiboken2/libshiboken/signature.cpp index 2f080edad..2cade65e0 100644 --- a/sources/shiboken2/libshiboken/signature.cpp +++ b/sources/shiboken2/libshiboken/signature.cpp @@ -730,7 +730,9 @@ static int pyside_set___signature__(PyObject *op, PyObject *value) { // By this additional check, this function refuses write access. - if (get_signature_intern(op, nullptr)) { + // We consider both nullptr and Py_None as not been written. + Shiboken::AutoDecRef has_val(get_signature_intern(op, nullptr)); + if (!(has_val.isNull() || has_val == Py_None)) { PyErr_Format(PyExc_AttributeError, "Attribute '__signature__' of '%.50s' object is not writable", Py_TYPE(op)->tp_name); |