Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE leaking ARGV into globals() namespace #82258

Closed
rhettinger opened this issue Sep 9, 2019 · 8 comments
Closed

IDLE leaking ARGV into globals() namespace #82258

rhettinger opened this issue Sep 9, 2019 · 8 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@rhettinger
Copy link
Contributor

BPO 38077
Nosy @rhettinger, @terryjreedy, @vedgar, @csabella, @miss-islington, @iritkatriel
PRs
  • bpo-38077: IDLE no longer adds 'argv' to the user namespace #15818
  • [3.8] bpo-38077: IDLE no longer adds 'argv' to the user namespace (GH-15818) #15819
  • [3.7] bpo-38077: IDLE no longer adds 'argv' to the user namespace (GH-15818) #15820
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2020-10-10.14:47:34.348>
    created_at = <Date 2019-09-09.21:13:04.487>
    labels = ['3.8', 'expert-IDLE', 'type-bug', '3.7', '3.9']
    title = 'IDLE leaking ARGV into globals() namespace'
    updated_at = <Date 2020-10-10.14:47:34.348>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2020-10-10.14:47:34.348>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2020-10-10.14:47:34.348>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2019-09-09.21:13:04.487>
    creator = 'rhettinger'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38077
    keywords = ['patch']
    message_count = 8.0
    messages = ['351552', '351563', '351566', '351568', '351569', '351571', '378398', '378410']
    nosy_count = 6.0
    nosy_names = ['rhettinger', 'terry.reedy', 'veky', 'cheryl.sabella', 'miss-islington', 'iritkatriel']
    pr_nums = ['15818', '15819', '15820']
    priority = 'high'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue38077'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @rhettinger
    Copy link
    Contributor Author

    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']

    @rhettinger rhettinger added 3.8 only security fixes 3.9 only security fixes labels Sep 9, 2019
    @rhettinger rhettinger added topic-IDLE type-bug An unexpected behavior, bug, or error 3.7 (EOL) end of life labels Sep 9, 2019
    @terryjreedy
    Copy link
    Member

    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 bpo-38078 to test and fix.

    @terryjreedy
    Copy link
    Member

    New changeset c59295a by Terry Jan Reedy in branch 'master':
    bpo-38077: IDLE no longer adds 'argv' to the user namespace (GH-15818)
    c59295a

    @miss-islington
    Copy link
    Contributor

    New changeset 29bde48 by Miss Islington (bot) in branch '3.8':
    bpo-38077: IDLE no longer adds 'argv' to the user namespace (GH-15818)
    29bde48

    @miss-islington
    Copy link
    Contributor

    New changeset 64947dc by Miss Islington (bot) in branch '3.7':
    bpo-38077: IDLE no longer adds 'argv' to the user namespace (GH-15818)
    64947dc

    @vedgar
    Copy link
    Mannequin

    vedgar mannequin commented Sep 10, 2019

    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.

    @iritkatriel
    Copy link
    Member

    This seems complete, can it be closed?

    @terryjreedy
    Copy link
    Member

    Since I opened the followup issue, yes. Thanks for noticing.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants