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

Weird repr output if repr contains dots

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 6.3.0
    • Shiboken
    • None

    Description

      When (I believe) the qDebug() output of something contains a dot, this results in an odd repr:

      >>> from PySide6.QtCore import QVersionNumber
      >>> QVersionNumber(1, 5, 0)
      <1.5.0 at 0x7f55fc334080>
      

      while I would have expected something like <QVersionNumber 1.5.0 at ...> or so.

      I believe this is due to the implementation of writeReprFunction in Shiboken:

          // 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 << "if (mod && !strchr(str, '.'))\n";
          {
              Indentation indent(s);
              s << "return Shiboken::String::fromFormat(\"<%s.%s at %p>\", Shiboken::String::toCString(mod), str.constData(), self);\n";
          }
          s << "else\n";
          {
              Indentation indent(s);
              s << "return Shiboken::String::fromFormat(\"<%s at %p>\", str.constData(), self);\n";
          }
      

      see PYSIDE-595.

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            the compiler Florian Bruhin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes