diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-20 09:50:01 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-30 17:57:33 +0200 |
commit | 12300111a002926d38afb69e5addb60146f2b2a5 (patch) | |
tree | f87784e2ad8db5bd49155e91bf787833aa0f1522 /sources/pyside2/PySide2/glue | |
parent | b4989b9c2b33772f23dd5f9763622e6fd3cf41a8 (diff) |
Speed: Avoid some repeated string constant initialization
This patch introduces a basic concept to avoid the repetition of
string constant creation in Python by using helper functions
returning static instances.
There is currently no real shiboken finalization, so we postpone
finalization until shiboken has one:
- call the finalize_strings() function
- build finalization for other stuff (all signatures etc)
Initial-patch-by: Christian Tismer <tismer@stackless.com>
Task-number: PYSIDE-1087
Change-Id: If3483ba91f719ee0472eb53583460ba35163bc9d
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/PySide2/glue')
-rw-r--r-- | sources/pyside2/PySide2/glue/qtcore.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index 93f7321aa..4c798aef9 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -308,7 +308,7 @@ PyModule_AddStringConstant(module, "__version__", qVersion()); // @snippet qobject-connect static bool isDecorator(PyObject *method, PyObject *self) { - Shiboken::AutoDecRef methodName(PyObject_GetAttrString(method, "__name__")); + Shiboken::AutoDecRef methodName(PyObject_GetAttr(method, Shiboken::PyMagicName::name())); if (!PyObject_HasAttr(self, methodName)) return true; Shiboken::AutoDecRef otherMethod(PyObject_GetAttr(self, methodName)); @@ -811,8 +811,8 @@ _findChildrenHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1), %P // @snippet qobject-tr QString result; if (QCoreApplication::instance()) { - PyObject *klass = PyObject_GetAttrString(%PYSELF, "__class__"); - PyObject *cname = PyObject_GetAttrString(klass, "__name__"); + PyObject *klass = PyObject_GetAttr(%PYSELF, Shiboken::PyMagicName::class_()); + PyObject *cname = PyObject_GetAttr(klass, Shiboken::PyMagicName::name()); result = QString(QCoreApplication::instance()->translate(Shiboken::String::toCString(cname), /* %1, %2, QCoreApplication::CodecForTr, %3)); */ %1, %2, %3)); |