[issue32111] ObjectListView crashes on python3.5
Balakrishnan Unnithan
report at bugs.python.org
Wed Nov 22 04:58:48 EST 2017
Balakrishnan Unnithan <bala.unnithan at gmail.com> added the comment:
Issue:
On Python3.5, ObjectListView object crashes when double-clicked in cell to edit int type.
-------------------------------------
Traceback (most recent call last):
File "C:\DevEnv\Python35\lib\site-packages\ObjectListView\ObjectListView.py", line 1726, in _HandleLeftClickOrDoubleClick
self._PossibleStartCellEdit(rowIndex, subItemIndex)
File "C:\DevEnv\Python35\lib\site-packages\ObjectListView\ObjectListView.py", line 2048, in _PossibleStartCellEdit
self.StartCellEdit(rowIndex, subItemIndex)
File "C:\DevEnv\Python35\lib\site-packages\ObjectListView\ObjectListView.py", line 2114, in StartCellEdit
self.cellEditor.SetValue(evt.cellValue)
File "C:\DevEnv\Python35\lib\site-packages\ObjectListView\CellEditor.py", line 268, in SetValue
if isinstance(value, (long, int, float)):
NameError: name 'long' is not defined
-------------------------------------
On debugging, I found that the actual root-cause of this bug lies in below code:
File: ..lib\site-packages\ObjectListView\CellEditor.py
Line: 100
-------------------------------------
def __init__(self):
self.typeToFunctionMap = {}
# Standard types and their creator functions
self.typeToFunctionMap[str] = self._MakeStringEditor
self.typeToFunctionMap[six.text_type] = self._MakeStringEditor
self.typeToFunctionMap[bool] = self._MakeBoolEditor
if six.PY2:
self.typeToFunctionMap[int] = self._MakeIntegerEditor
self.typeToFunctionMap[long] = self._MakeLongEditor
else:
#Line:100
self.typeToFunctionMap[int] = self._MakeLongEditor
self.typeToFunctionMap[float] = self._MakeFloatEditor
self.typeToFunctionMap[datetime.datetime] = self._MakeDateTimeEditor
self.typeToFunctionMap[datetime.date] = self._MakeDateEditor
self.typeToFunctionMap[datetime.time] = self._MakeTimeEditor
-------------------------------------
Modified code:
-------------------------------------
if six.PY2:
self.typeToFunctionMap[int] = self._MakeIntegerEditor
self.typeToFunctionMap[long] = self._MakeLongEditor
else:
#Line:100
self.typeToFunctionMap[int] = self._MakeIntegerEditor
-------------------------------------
In place of integer type editor, long type editor is being created.
As Python3.x does not support long type, the programme crashes here.
----------
status: pending -> open
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32111>
_______________________________________
More information about the Python-bugs-list
mailing list