This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Balakrishnan Unnithan
Recipients Balakrishnan Unnithan, serhiy.storchaka
Date 2017-11-22.09:58:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1511344728.81.0.213398074469.issue32111@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-11-22 09:58:48Balakrishnan Unnithansetrecipients: + Balakrishnan Unnithan, serhiy.storchaka
2017-11-22 09:58:48Balakrishnan Unnithansetmessageid: <1511344728.81.0.213398074469.issue32111@psf.upfronthosting.co.za>
2017-11-22 09:58:48Balakrishnan Unnithanlinkissue32111 messages
2017-11-22 09:58:48Balakrishnan Unnithancreate