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

2020-03-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thank you for investigating this.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-30 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Reproducer: In Shell, run "input('prompt'),  Without giving a response, so that 
input is left 'executing', switch to editor with valid code, select "Run... 
Customized", unselect "Restart shell", and select OK.  One will twice see and 
have to click away a box with
  The Python Shell window is already executing a command;
   please wait until it is finished.
Then the attribute error error appears.

Explanation: Run Module first compiles the editor code to check for syntax 
errors.  If successful, it 1. restarts the execution process, which *resets 
executing to False*; 2. runs internal commands with runcommand (called twice) 
to change working directory, augment sys.path, and possibly change sys.args.  
3. runs the compiled user code with runcode.  Thus, the buggy 'executing' 
clause cannot be triggered.

Run Customized with "Restart shell" unchecked skips the restart and 'executing' 
may be left True.  If so, runcommand displays the message above and returns 
False, instead of running the command and returning True.  The runscript code 
currently ignores the return and calls runcode anyway. 

Guiding principle: The effect of running with run customized with given 
settings should not depend on whether executable happens to be true when the 
first runcommand is called.  I verified with time.sleep(15) that a statement 
can finish executing and executable reset to False while a user is reading the 
first 'executing' message.  Since setting args has be skipped, the run should 
be stopped.

Fixes:
1. Only display one 'executing' message.  Either make the 2nd runcommand 
conditioned on the first succeeding, or combine the two partial duplicate 
runcommand calls into one.  I will start with the first.


2. Improve the error message.  The user should only run without restart when 
there is a waiting '>>>' prompt and may need to take action (respond to 
input(), close a tkinter window, restart a hung execution).  The message should 
say 'Try again' since execution will not happen.

3. Don't run the users code after the message is given.

4. Fix the AttributeError as specified in my previous message.  For running 
editor code, runcode will again not ever be called with executing True, and it 
may be that the clause could be deleted.  But I am not sure what is possible is 
IDLE is started with both -s (run IDLESTARTUP or PYTHONSTARTUP) and -r file 
(run file), both of which also call runcode.

--
stage: patch review -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-28 Thread miss-islington


miss-islington  added the comment:


New changeset cb758011ce39678fb03e8ac3e924d9084252e1ad by Miss Islington (bot) 
in branch '3.7':
bpo-38002: Use False/True for IDLE pyshell bools (GH-19203)
https://github.com/python/cpython/commit/cb758011ce39678fb03e8ac3e924d9084252e1ad


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-28 Thread miss-islington


miss-islington  added the comment:


New changeset 8c3ab189ae552401581ecf0b260a96d80dcdae28 by Miss Islington (bot) 
in branch '3.8':
bpo-38002: Use False/True for IDLE pyshell bools (GH-19203)
https://github.com/python/cpython/commit/8c3ab189ae552401581ecf0b260a96d80dcdae28


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18571
pull_request: https://github.com/python/cpython/pull/19208

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-28 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +18570
pull_request: https://github.com/python/cpython/pull/19207

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 34a49aa3e4d023b5f9e9029f4f1ec68f1a8a8120 by Terry Jan Reedy in 
branch 'master':
bpo-38002: Use False/True for IDLE pyshell bools (GH-19203)
https://github.com/python/cpython/commit/34a49aa3e4d023b5f9e9029f4f1ec68f1a8a8120


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-28 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch
pull_requests: +18566
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19203

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2020-03-27 Thread Terry J. Reedy


Terry J. Reedy  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2019-09-01 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Here's a new traceback I haven't seen before.  I only see these at the end of a 
session, so I don't know which steps triggered it.

$ python3.8 -m idlelib.idle tmp_pretty_fact_ast.py
Exception in Tkinter callback
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/__init__.py",
 line 1883, in __call__
return self.func(*args)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/runscript.py",
 line 173, in _run_module_event
interp.runcode(code)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/pyshell.py",
 line 756, in runcode
self.interp.restart_subprocess()
AttributeError: 'ModifiedInterpreter' object has no attribute 'interp'

--
assignee: terry.reedy
components: IDLE
messages: 350961
nosy: rhettinger, terry.reedy
priority: normal
severity: normal
status: open
title: 'ModifiedInterpreter' object has no attribute 'interp'
versions: Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com