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

VoidPtr: Adapt `repr` and `str` methods to properly handle strings in Python 2 and 3

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 5.12.0
    • 5.11.2
    • Shiboken
    • None
    • All
    • 3fd18df188073b95ddb28b5e5f2307fa08b7c2dd

    Description

      Trying to call `str` or `repr` on VoidPtr is not working at the moment, because after the changes related to PyString/PyUnicode this was not updated.

      >>> from PySide2.QtCore import *
      >>> from PySide2.support import VoidPtr
      >>> o = QObject()
      >>> p = VoidPtr(o)
      >>> print(p)
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      TypeError: __str__ returned non-string (type bytes)
      >>> print(str(p))
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      TypeError: __str__ returned non-string (type bytes)
      >>> print(repr(p))
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      TypeError: __repr__ returned non-string (type bytes)
      >>> print(int(p))
      94198306228352
      

      Attachments

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

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            crmaurei Cristian Maureira-Fredes
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes