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

Speed: Stop wasting time in Python string creation

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • P3: Somewhat important
    • 6.0.0
    • 5.14.0
    • PySide, Shiboken
    • None

    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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            ctismer Christian Tismer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes