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
An OverflowError is raised when passing a 64-bit long value through the data method of a QSortFilterProxyModel. This only occurs on Linux. No error occurs and the correct value is returned on Windows. In both cases, 64-bit builds of Python 2.7.8 and PySide 1.2.2 are used.
First, here is the minimal example needed to reproduce this error:
from PySide import QtGui, QtCore
from PySide.QtCore import Qt
class TestModel(QtCore.QAbstractListModel):
def rowCount(self, parent=None):
return 1
def data(self, index, role=Qt.DisplayRole):
if role == Qt.DisplayRole:
return (1 << 45)
def main():
model = TestModel()
proxyModel = QtGui.QSortFilterProxyModel()
proxyModel.setSourceModel(model)
val = proxyModel.data(proxyModel.index(0, 0, QtCore.QModelIndex()))
assert (1<<45) == val
if __name__ == '__main__':
main()
And the error that results:
val = proxyModel.data(proxyModel.index(0, 0, QtCore.QModelIndex()))
OverflowError
This error is surprising, and is not justified by any of the other reasons for raising an OverflowError (e.g. passing a 64-bit value into a Qt function whose argument type is int or short). This is because QAbstractItemModel and subclasses have a QVariant return type for data().
I have not tested this with debug builds of PySide, so this is only my suspicion: The CppWrapper for TestModel will convert the Py_Long returned by the Python data method into a QVariant, and this is where the OverflowError occurs.
The text was updated successfully, but these errors were encountered:
An OverflowError is raised when passing a 64-bit
long
value through thedata
method of aQSortFilterProxyModel
. This only occurs on Linux. No error occurs and the correct value is returned on Windows. In both cases, 64-bit builds of Python 2.7.8 and PySide 1.2.2 are used.First, here is the minimal example needed to reproduce this error:
And the error that results:
This error is surprising, and is not justified by any of the other reasons for raising an OverflowError (e.g. passing a 64-bit value into a Qt function whose argument type is
int
orshort
). This is becauseQAbstractItemModel
and subclasses have aQVariant
return type fordata()
.I have not tested this with debug builds of PySide, so this is only my suspicion: The CppWrapper for
TestModel
will convert the Py_Long returned by the Pythondata
method into aQVariant
, and this is where the OverflowError occurs.The text was updated successfully, but these errors were encountered: