← 返回首页
bpo-36375: PEP 499 implementation: "python -m foo" binds the main module as both __main__ and foo in sys.modules by cameron-simpson · Pull Request #12490 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

bpo-36375: PEP 499 implementation: "python -m foo" binds the main module as both __main__ and foo in sys.modules#12490

Closed
cameron-simpson wants to merge 10 commits into
python:mainfrom
cameron-simpson:PEP499-cs
Closed

bpo-36375: PEP 499 implementation: "python -m foo" binds the main module as both __main__ and foo in sys.modules#12490
cameron-simpson wants to merge 10 commits into
python:mainfrom
cameron-simpson:PEP499-cs

Conversation

cameron-simpson commented Mar 22, 2019
edited by bedevere-bot
Loading

Copy link
Copy Markdown

This contains documentation updates, runpy.py implementation, two unit tests and a fix for Lib/pdb.py to accomodate new aliasing of __main__ as the module's canonical name.

A run of "make test" on my El Capitan Mac here now shows the following failures:

test_c_locale_coercion test_smtpnet test_ssl test_urllib test_urllib2 test_urllib2net test_xmlrpc

Of these:

test_c_locale_coercion appears to be due to differences between my OS release and presumably more modern Darwin releases: various "utf-8" vs "ascii" mismatches in the output.

text_xmlrpc seems to run forever, here

the other tests fail for network based reasons.

WRT to a run against the master branch, the failure set is the same.

I cannot reproduce the hashlib based failures seen by Travis on my earlier PR. It will be interesting to see what Travis says now.

https://bugs.python.org/issue36375

ncoghlan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Just adding a blocking review to ensure the PR isn't merged until after the PEP has been reviewed.

Copy link
Copy Markdown

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Comment thread Lib/pdb.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

This won't interact correctly with the interpreter's -i switch, as that always drops you into the original __main__ namespace, even if it's been rebound in sys.modules by the application code.

Copy link
Copy Markdown
Contributor

@cameron-simpson This is looking pretty good, but there are still some backwards compatibility risks that we're going to have to investigate before the PEP can be approved.

I'm officially the design & implementation reviewer for this PEP now, so I added the two key questions/concerns that I'm currently aware of to a new section: python/peps#946

Copy link
Copy Markdown
Contributor

Closing this, as the linked issue has been closed.

erlend-aasland removed the pending The issue will be closed if no feedback is provided label Sep 6, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

Footer

© 2026 GitHub, Inc.