[New-bugs-announce] [issue22614] Idle: problem in PyShellEditorWindow.color_breakpoint_text

Terry J. Reedy report at bugs.python.org
Sun Oct 12 00:18:00 CEST 2014

New submission from Terry J. Reedy:

In Jan 2014 in the opening messages of #20167, msg207599, Serhiy Storchaka reported that
./python -m idlelib.idle Lib/decimal.py
opened the file on both 2.7 and 3.4 (beta) but that closing on 3.4 (but not 2.7) caused 'application closed' errors in Multicall .__del__ methods. These have been fixed and recently refixed.

In msg228954, Serhiy reported a new problem, which I an transferring to this new issue, with 2.7 and 3.4 but not 3.5.

./python -m idlelib.idle Lib/decimal.py
Traceback (most recent call last):
  File "/home/serhiy/py/cpython-3.4/Lib/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/serhiy/py/cpython-3.4/Lib/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/idle.py", line 11, in <module>
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/PyShell.py", line 1562, in main
    if flist.open(filename) is None:
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/FileList.py", line 36, in open
    edit = self.EditorWindow(self, filename, key)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/PyShell.py", line 141, in __init__
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/PyShell.py", line 159, in color_breakpoint_text
    self.text.tag_config('BREAK', cfg)
AttributeError: 'NoneType' object has no attribute 'tag_config'

Serhiy, you did not specify the particular binaries you used. I will assume recent.

Versions: as far as I know, there are no idlelib code differences between 3.4 and default (3.5).  I rechecked closed issues for patches pushed by someone else only to 3.5.  So any behavior difference between 3.4 and 3.5 must by due to a difference in tkinter, another stdlib module, or python itself.

What system? I do not reproduce on Win 7 with an Oct 9 build.

When?  If the command line worked for 2.7 in Jan and fails now, when did it start failing?  If the command worked for 3.4 after the Feb patches and fails now, same question.

How? You did not state, but in a later message implied that the file opened in the editor and the problem only happened when you closed, as with the January report.  However, the traceback says that the problem occurred during initialization.  According to Find in Files, the only call to color_breakpoint_text is that one __init__ call.  I therefore do not understand your msg228957 comment "The code runs up to self.text.update() in restore_file_breaks() and runs further only after windows closing."

restore_file_breaks is only called in two places. One is when file names are changed (which should not happen when closing an untouched file), the other is just before color_break during initialization.  Here is the last part of PyShellEditorWindow.__init__.

        def filename_changed_hook(old_hook=self.io.filename_change_hook,
        if self.io.filename:

You msg228958 comment that changing .update to .update_idletasks also puzzles me. According to the tkinter docstrings, the difference is that the latter does less (assuming that .update also clears non-user callbacks, whatever they are)

    Enter event loop until all pending events have been processed by Tcl.

    Enter event loop until all idle callbacks have been called. This
    will update the display of windows but not process events caused by
    the user.

During initialization, I would not expect there to be any user events.

messages: 229105
nosy: serhiy.storchaka, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Idle: problem in PyShellEditorWindow.color_breakpoint_text
type: behavior
versions: Python 2.7, Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list