Author terry.reedy
Recipients terry.reedy
Date 2019-09-10.01:37:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
#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.
Date User Action Args
2019-09-10 01:37:51terry.reedysetrecipients: + terry.reedy
2019-09-10 01:37:51terry.reedysetmessageid: <>
2019-09-10 01:37:51terry.reedylinkissue38078 messages
2019-09-10 01:37:50terry.reedycreate