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

Segfault when using bytes() on a QByteArray

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.14.1
    • PySide
    • None

      This code:

      import sys
      from PySide2.QtCore import QCoreApplication, QByteArray
      
      app = QCoreApplication(sys.argv)
      
      qba = QByteArray(b'Hello World')
      print(bytes(qba).decode())
      

      crashes here:

      #0  0x00007ffff7afafb0 in PyBuffer_IsContiguous () from /usr/lib/libpython3.8.so.1.0
      #1  0x00007ffff7b3bc3c in PyBuffer_ToContiguous () from /usr/lib/libpython3.8.so.1.0
      #2  0x00007ffff7c0cf99 in ?? () from /usr/lib/libpython3.8.so.1.0
      #3  0x00007ffff7bb5b30 in ?? () from /usr/lib/libpython3.8.so.1.0
      #4  0x00007ffff7b1bc96 in _PyObject_MakeTpCall () from /usr/lib/libpython3.8.so.1.0
      #5  0x00007ffff7bd94d4 in _PyEval_EvalFrameDefault () from /usr/lib/libpython3.8.so.1.0
      #6  0x00007ffff7bc4f34 in _PyEval_EvalCodeWithName () from /usr/lib/libpython3.8.so.1.0
      #7  0x00007ffff7c4c873 in PyEval_EvalCode () from /usr/lib/libpython3.8.so.1.0
      #8  0x00007ffff7c4c8c8 in ?? () from /usr/lib/libpython3.8.so.1.0
      #9  0x00007ffff7c50ba3 in ?? () from /usr/lib/libpython3.8.so.1.0
      #10 0x00007ffff7aeba1f in PyRun_FileExFlags () from /usr/lib/libpython3.8.so.1.0
      #11 0x00007ffff7af56d7 in PyRun_SimpleFileExFlags () from /usr/lib/libpython3.8.so.1.0
      #12 0x00007ffff7c5d35e in Py_RunMain () from /usr/lib/libpython3.8.so.1.0
      #13 0x00007ffff7c5d449 in Py_BytesMain () from /usr/lib/libpython3.8.so.1.0
      #14 0x00007ffff7dcd023 in __libc_start_main () from /usr/lib/libc.so.6
      #15 0x000055555555505e in _start ()
      

      Doing the same with PyQt5 works. Using qba.data() instead of bytes(qba) also works.

        1. pyside1248.py
          0.2 kB
          Friedemann Kleint
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            crmaurei Cristian Maureira-Fredes
            the compiler Florian Bruhin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes