[PyQt] Bug in qpycore_PyObject_AsQString

Kovid Goyal kovid at kovidgoyal.net
Sat Sep 19 09:36:02 BST 2015


I saw the following assert in one of my programs:

python3: ../qpy/QtCore/qpycore_qstring.cpp:165: QString qpycore_PyObject_AsQString(PyObject*): Assertion `(((PyASCIIObject*)obj)->state.ready)' failed.

This will happen if a python string that is not "ready" is passed into a
PyQt API (such strings can be created by C python extensions, notably
sqlite). That function should call PyUnicode_READY (and check its return
value). 

As a workaround, one can call str() on the string before passing it to
PyQt.

Kovid.

-- 
_____________________________________

Dr. Kovid Goyal 
http://www.kovidgoyal.net
http://calibre-ebook.com
_____________________________________


More information about the PyQt mailing list