Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1087

Speed: Stop wasting time in Python string creation

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.14
    • Fix Version/s: 5.14
    • Component/s: PySide, Shiboken
    • Labels:
      None
    • Technical Risk:
      Normal

      Description

      PySide and Shiboken make a lot of use of Python strings. The simple way to use Python strings is for instance

      PyObject *attr = PyObject_GetAttrString(obj, "sys");
      PyObject *attr = PyObject_GetAttrString(obj, "__module__");
      

      We give an alternative implementation instead, that lets you write

      PyObject *attr = PyObject_GetAttr(obj, PyName::sys());
      PyObject *attr = PyObject_GetAttr(obj, PyMagicName::module());
      

      This solution works without any macros and uses the namespace feature as a benefit.

      The solution is no longer a prototype and implements the feature for all ...String() functions, including the generated source code. The necessary string functions are half-automatically generated by running tools/scrape-names.py. There are 1580 generated static string functions at the moment.

        Attachments

        For Gerrit Dashboard: PYSIDE-1087
        # Subject Branch Project Status CR V

          Activity

            People

            • Assignee:
              kleint Friedemann Kleint
              Reporter:
              ctismer Christian Tismer
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There is 1 open Gerrit change