Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-118908: Limit exposed globals from internal imports and definitions on new REPL startup#119547
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for the PR@eugenetriguba but unfortunately I don't think this is the proper fix for this issue. The proper fix is to properly filter the namespace here:
cpython/Lib/_pyrepl/simple_interact.py
Line 122 inb407ad3
mainmodule=mainmoduleor__main__ |
And to use a clean one when it makes sense (when not running with -i) or filtering the stuff we don't want.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looks good! 🎉
Just a couple of comments.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Just one final comment and this is good to go! Thanks both!
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM!
86a8a1c
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@eugenetriguba for the PR, and@pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…nitions on new REPL startup (pythonGH-119547)(cherry picked from commit86a8a1c)Co-authored-by: Eugene Triguba <eugenetriguba@gmail.com>
GH-120362 is a backport of this pull request to the3.13 branch. |
@pablogsal Been a bit busy and was unable to get back to this, thank you for finishing it off and the feedback 🙂 |
Since this commit, the "AMD64 Debian PGO 3.x" buildbot has started reporting a runaway process, e.g.here:
|
…nitions on new REPL startup (python#119547)
…nitions on new REPL startup (python#119547)
…nitions on new REPL startup (python#119547)
Uh oh!
There was an error while loading.Please reload this page.
Currently, we expose some of the internal imports and definitions on REPL startup in the new REPL.
This PR addresses that by moving the implementation of main into its own separate module and only importing in what is needed to get it running. Now, we see there is only
interactive_console
in addition to the dunder attributes shown in the global scope on startup.