You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the following code snippet fails with the message
python3: ../../../qpy/QtCore/qpycore_qstring.cpp :96 : QString qpycore_PyObject_AsQString(PyObject_): l'assertion « (((PyASCIIObject_)obj)->state.ready) » a échoué.
Code:
!/usr/bin/env python3
-- coding: utf-8 --
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import apsw
from Ui_test3 import Ui_Test3
class Test3Dialog(QMainWindow, Ui_Test3):
def init(self):
QMainWindow.init(self)
# Set up the user interface from Designer.
self.setupUi(self)
self.cx = apsw.Connection("/home/pm/.datamanager/data/datamanager.sqlite")
self.curseur=self.cx.cursor()
self.curseur.execute("SELECT DISTINCT projet FROM projets WHERE actif='True' ORDER BY projet;")
#projets=["{}".format(x[0]) for x in self.curseur.fetchall()]
projets=[x[0] for x in self.curseur.fetchall()]
self.projectBox.addItems(projets)
if name == "main":
import sys
app = QApplication(sys.argv)
If the statement projets=[x[0] for x in self.curseur.fetchall()]
is replaced by projets=["{}".format(x[0]) for x in self.curseur.fetchall()]
it runs ok
the "datamanager.sqlite database has been used for years in python2 without any pb.
the Ui_test3.py file is automatically generated by pyuic from a qt-designer file 👍
-- coding: utf-8 --
Form implementation generated from reading ui file '/home/pm/Apps3/datamanager/sources/test3.ui'
Created: Wed Aug 6 14:19:54 2014
by: PyQt4 UI code generator 4.10.4
WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
Technically APSW is in the right. PEP 393 changed how the CPython API for strings worked so it could use different (and usually shorter) internal representations. A call to PyUnicode_READY is required to perform that internal work.
However PEP 393 guarantees 5 years of backwards compatibility. Other extensions that care about the internal representation should be calling PyUnicode_READY themselves to ensure the backwards compatibility on received strings, and PyQt has not done so. Strings coming from the core interpreter already have it, so the PyQt authors wouldn't have noticed.
APSW will do so itself at some point, but I need to do careful compatibility testing and benchmarking.
apsw 3.8.2-r1-1-ubuntu1
python3 3.4.0-0ubuntu2
python3-pyqt4 4.10.4+dfsg1-ubuntu1
the following code snippet fails with the message
python3: ../../../qpy/QtCore/qpycore_qstring.cpp :96 : QString qpycore_PyObject_AsQString(PyObject_): l'assertion « (((PyASCIIObject_)obj)->state.ready) » a échoué.
Code:
!/usr/bin/env python3
-- coding: utf-8 --
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import apsw
from Ui_test3 import Ui_Test3
class Test3Dialog(QMainWindow, Ui_Test3):
def init(self):
QMainWindow.init(self)
# Set up the user interface from Designer.
self.setupUi(self)
self.cx = apsw.Connection("/home/pm/.datamanager/data/datamanager.sqlite")
self.curseur=self.cx.cursor()
self.curseur.execute("SELECT DISTINCT projet FROM projets WHERE actif='True' ORDER BY projet;")
#projets=["{}".format(x[0]) for x in self.curseur.fetchall()]
projets=[x[0] for x in self.curseur.fetchall()]
self.projectBox.addItems(projets)
if name == "main":
import sys
app = QApplication(sys.argv)
If the statement projets=[x[0] for x in self.curseur.fetchall()]
is replaced by projets=["{}".format(x[0]) for x in self.curseur.fetchall()]
it runs ok
the "datamanager.sqlite database has been used for years in python2 without any pb.
the Ui_test3.py file is automatically generated by pyuic from a qt-designer file 👍
-- coding: utf-8 --
Form implementation generated from reading ui file '/home/pm/Apps3/datamanager/sources/test3.ui'
Created: Wed Aug 6 14:19:54 2014
by: PyQt4 UI code generator 4.10.4
WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_Test3(object):
def setupUi(self, Test3):
Test3.setObjectName(_fromUtf8("Test3"))
Test3.resize(156, 138)
self.centralwidget = QtGui.QWidget(Test3)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.projectBox = QtGui.QComboBox(self.centralwidget)
self.projectBox.setGeometry(QtCore.QRect(20, 20, 82, 31))
self.projectBox.setObjectName(_fromUtf8("projectBox"))
Test3.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(Test3)
self.menubar.setGeometry(QtCore.QRect(0, 0, 156, 25))
self.menubar.setObjectName(_fromUtf8("menubar"))
Test3.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(Test3)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
Test3.setStatusBar(self.statusbar)
if name == "main":
import sys
app = QtGui.QApplication(sys.argv)
Test3 = QtGui.QMainWindow()
ui = Ui_Test3()
ui.setupUi(Test3)
Test3.show()
sys.exit(app.exec_())
The text was updated successfully, but these errors were encountered: