Issue38078
Created on 2019-09-10 01:37 by terry.reedy, last changed 2021-02-01 22:30 by terry.reedy. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 20040 | closed | ZackerySpytz, 2020-05-11 22:36 | |
| Messages (2) | |||
|---|---|---|---|
| msg351562 - (view) | Author: Terry J. Reedy (terry.reedy) * | Date: 2019-09-10 01:37 | |
#38077 fixed the bug of internal runcommand code not deleting 'argv' from the user namespace. This issue is about not running code there. When a subprocess is running, pyshell.ModifiedInterpreter.runcommand runs python code created by IDLE in locals == __main__.__dict__, the same as code enter by a user. This requires that the code carefully clean up after itself. I believe the same effect could by had more safely by exec-ing internal commands in the run module dict or a fresh temporary dict. Possible solution. In run.Executive.runcode, add 'user=True' to runcode signature, add 'if user else {}' to 'self.locals' arg, and add def runcommand(self, code): return self.runcode(code, user=False). Then replace 'runcode' with 'runcommand' in pyshell runcommand body. |
|||
| msg386119 - (view) | Author: Terry J. Reedy (terry.reedy) * | Date: 2021-02-01 22:30 | |
Zachery, thank you for the PR to test. It turns out that the proposed change is more dangerous the the possible error it prevent. I could have easily missed the problem (not setting __file__, see PR). Before considering this again, I need to list ways to run user code with Python and what envivonment (cwd, path, dir() results. Then see what IDLE does in corresponding situations. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2021-02-01 22:30:00 | terry.reedy | set | status: open -> closed resolution: rejected messages: + msg386119 stage: patch review -> resolved |
| 2020-05-11 22:36:36 | ZackerySpytz | set | keywords:
+ patch nosy: + ZackerySpytz pull_requests:
+ pull_request19351 |
| 2019-09-10 01:37:51 | terry.reedy | create | |