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/shiboken2/generator/shiboken2 | |
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/shiboken2/generator/shiboken2')
-rw-r--r-- | sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 85ce8f954..5e9d9378e 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -6018,7 +6018,7 @@ QString CppGenerator::writeReprFunction(QTextStream &s, GeneratorContext &contex Indentation indent(INDENT); s << INDENT << "str.replace(0, idx, Py_TYPE(self)->tp_name);" << endl; } - s << INDENT << "PyObject *mod = PyDict_GetItemString(Py_TYPE(self)->tp_dict, \"__module__\");" << endl; + s << INDENT << "PyObject *mod = PyDict_GetItem(Py_TYPE(self)->tp_dict, Shiboken::PyMagicName::module());" << endl; // PYSIDE-595: The introduction of heap types has the side effect that the module name // is always prepended to the type name. Therefore the strchr check: s << INDENT << "if (mod && !strchr(str, '.'))" << endl; |