This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE leaking ARGV into globals() namespace
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: cheryl.sabella, iritkatriel, miss-islington, rhettinger, terry.reedy, veky
Priority: high Keywords: patch

Created on 2019-09-09 21:13 by rhettinger, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 15818 merged terry.reedy, 2019-09-10 02:22
PR 15819 merged miss-islington, 2019-09-10 03:10
PR 15820 merged miss-islington, 2019-09-10 03:11
Messages (8)
msg351552 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-09-09 21:13
Reproducer:

1) Turn-on IDLE
2) Create an empty file called: tmp.py
3) Press F5 to run the empty file
4) In the output shell window, type dir() which gives

>>> dir()
['__annotations__', '__builtins__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'argv']
msg351563 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-09-10 02:07
I verified that 'argv' (bound to sys.argv)  appears for all three versions after running an editor file, but not when Shell is started normally, without a file.

The immediate culprit is the runcommand code in runscript, lines 156-168.  As part of the patch to allow additions to sys.argv, temporary name 'argv' was added but not deleted at the end.  I missed this when I reviewed the patch.  So this bug only affected 3.7.4 and 3.8.0b2 to 3.8.0b4. The immediate fix is trivial.

The deeper problem is running internal IDLE code in the user namespace.  I believe that this is not necessary and opened #38078 to test and fix.
msg351566 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-09-10 03:10
New changeset c59295a1ca304f37ca136dd7efca9e560db27d28 by Terry Jan Reedy in branch 'master':
bpo-38077: IDLE no longer adds 'argv' to the user namespace (GH-15818)
https://github.com/python/cpython/commit/c59295a1ca304f37ca136dd7efca9e560db27d28
msg351568 - (view) Author: miss-islington (miss-islington) Date: 2019-09-10 03:29
New changeset 29bde48ade5dbd5d88cfe309653014c84bebb89c by Miss Islington (bot) in branch '3.8':
bpo-38077: IDLE no longer adds 'argv' to the user namespace (GH-15818)
https://github.com/python/cpython/commit/29bde48ade5dbd5d88cfe309653014c84bebb89c
msg351569 - (view) Author: miss-islington (miss-islington) Date: 2019-09-10 03:33
New changeset 64947dc81a94692fa8ed21c2199a19a0188150ad by Miss Islington (bot) in branch '3.7':
bpo-38077: IDLE no longer adds 'argv' to the user namespace (GH-15818)
https://github.com/python/cpython/commit/64947dc81a94692fa8ed21c2199a19a0188150ad
msg351571 - (view) Author: Vedran Čačić (veky) * Date: 2019-09-10 05:00
I just want to express my delight, Terry, about your desire to solve the root of the problem instead of just fixing a particular instance. (This is not the first time I witnessed that.) It's a big part of the reason why I love Python so much.
msg378398 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-10-10 13:30
This seems complete, can it be closed?
msg378410 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-10-10 14:47
Since I opened the followup issue, yes.  Thanks for noticing.
History
Date User Action Args
2022-04-11 14:59:20adminsetgithub: 82258
2020-10-10 14:47:34terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg378410

stage: patch review -> resolved
2020-10-10 13:30:27iritkatrielsetnosy: + iritkatriel
messages: + msg378398
2019-09-10 05:00:03vekysetnosy: + veky
messages: + msg351571
2019-09-10 03:33:27miss-islingtonsetmessages: + msg351569
2019-09-10 03:29:04miss-islingtonsetnosy: + miss-islington
messages: + msg351568
2019-09-10 03:11:06miss-islingtonsetpull_requests: + pull_request15468
2019-09-10 03:10:59miss-islingtonsetpull_requests: + pull_request15467
2019-09-10 03:10:52terry.reedysetmessages: + msg351566
2019-09-10 02:22:23terry.reedysetkeywords: + patch
stage: patch review
pull_requests: + pull_request15466
2019-09-10 02:08:00terry.reedysetnosy: + cheryl.sabella
messages: + msg351563
2019-09-09 21:15:47rhettingersetversions: + Python 3.7
2019-09-09 21:13:04rhettingercreate