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.

classification
Title: ObjectListView crashes on python3.5
Type: crash Stage: resolved
Components: Extension Modules Versions: Python 3.5
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: Balakrishnan Unnithan, ronaldoussoren, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-11-22 09:46 by Balakrishnan Unnithan, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg306709 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-22 09:49
Could you provide more information Balakrishnan?
msg306711 - (view) Author: Balakrishnan Unnithan (Balakrishnan Unnithan) Date: 2017-11-22 09:58
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.
msg306713 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2017-11-22 10:04
This appears to be an issue with a 3th-party library (https://pypi.python.org/pypi/ObjectListView), not CPython itself.

The repository (and issue tracker) for that library is at <https://bitbucket.org/wbruhin/objectlistview>. 

@Balakrishnan: could you confirm that you are using this library? And if so, please file an issue with that project.
msg306714 - (view) Author: Balakrishnan Unnithan (Balakrishnan Unnithan) Date: 2017-11-22 10:07
Yes, I am using this 3rd party library. Okay, I shall withdraw the issue from here.
I'm new to Python and hence do not know the various groups and their purpose.
Apologies!
Thanks for the support.

Version info:
ObjectListView 1.3.1
Python 3.5.4 (v3.5.4:3f56838, Aug  8 2017, 02:07:06) [MSC v.1900 32 bit (Intel)] on win32
History
Date User Action Args
2022-04-11 14:58:54adminsetgithub: 76292
2017-11-22 10:08:04christian.heimessetstatus: open -> closed
resolution: third party
stage: resolved
2017-11-22 10:07:27Balakrishnan Unnithansetmessages: + msg306714
2017-11-22 10:04:03ronaldoussorensetnosy: + ronaldoussoren
messages: + msg306713
2017-11-22 09:58:48Balakrishnan Unnithansetstatus: pending -> open

messages: + msg306711
2017-11-22 09:49:11serhiy.storchakasetstatus: open -> pending
nosy: + serhiy.storchaka
messages: + msg306709

2017-11-22 09:46:06Balakrishnan Unnithancreate