Terry J. Reedy <tjre...@udel.edu> added the comment:

I tested on 3.2, Win 7. sys.path starts with '' on startup, after restart, and 
after ^c interrupt of 'while True: pass'. It start with absolute path when 
running a file from the editor. I believe this is as should be.

I simplified the patch a bit. Its basic idea is to add a parameter with_cwd to 
PyShell.ModifiedInterpreter.transfer_path. That method is called by methods 
start_subprocess and restart_subprocess. start_process is only called by 
PyShell.PyShell.begin. So I think there is no need to propagate the new 
parameter back past the call in start_subprocess.

.restart_subprocess is called in .poll_subprocess, .runcode, 
PyShell.cancel_process, and PyShell.restart_shell. (I am a little puzzled why 
ModifiedInterpreter.runcode calls self.interp.restart_subprocess, as in the 
PyShell methods, instead of self.restart_subprocess, as in poll_subprocess, but 
moving on...)

restart_process needs the new parameter to pass to transfer_path because it 
should be True for F6 Restart Shell and not for F5 Run Module. Roger's patch 
also left the default False for the other calls. I do not know what they do so 
I cannot judge them. Roger, do you know, and did you consider each? (Leaving 
the current behavior for those will at worst not fix something that could be, 
so it is safe.)

restart_shell is *bound* to F6 Restart Shell (which passes the ignored even), 
so the default with_cwd must be True for that binding. It is *called* by a 
function ScriptBinding.py that gets bound, so the call can be altered to pass 
the correct False. I prefer that to making two functions. That call could be 
replaces by a call directly to .interp.restart_subprocess(False) (and 
restart_shell slightly simplified).

I retested after these changes to the patch. It is from TortoiseHG, so should 
apply (after I modified the file paths). Since hacking on idlelib is new for 
me, I would like other eyes and tests before I apply.

----------
assignee:  -> terry.reedy
Added file: http://bugs.python.org/file24376/issue13506c.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13506>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to