[issue38002] 'ModifiedInterpreter' object has no attribute 'interp'

Terry J. Reedy report at bugs.python.org
Fri Mar 27 17:17:46 EDT 2020


Terry J. Reedy <tjreedy at udel.edu> added the comment:

You tried to run editor code and ran into a uncaught idle-process bug, which causes an exit.

pyshell.ModifiedInterpreter.runcode: 760-1
        if self.tkconsole.executing:
            self.interp.restart_subprocess()

The immediate bug is that 'self' *is* the interpreter with the restart_subprocess method, so '.interp' needs to be deleted.  An easy fix in itself.

Puzzle 1 is that I expect that 'executing' should be true whenever Shell is not waiting for a response to '>>>', so that we should be seeing this often.  But it is false when running tkinter code, when sleeping, and when waiting for input(prompt) response, so I don't know how it was ever true for you.

I don't remember ever seeing this exception. I will look at the code that sets and resets it.  Maybe the former is not being called when it should be.

Puzzle 2 is that the subprocess *is* being restarted even with this code being (normally) skipped.  Is it ever needed, even in the (unknown) circumstance that 'executing' is true?  Or would that cause two restarts? This would be a new buglet, though preferable to the current exception exit.  The easy fix may not be enough.

'executing' and other shell booleans are still set as 0 and 1.  I may update these first.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38002>
_______________________________________


More information about the Python-bugs-list mailing list