-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Idle, 2.7, backport idlelib.__main__, enable py -m idlelib #68400
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
Comments
Discussion on another issue suggested that 3.x idlelib.__main__ be backported to 2.7 so 'python -m idlelib would work with 2.7 as with 3.x. The current file: """ When I tried this, it failed two ways.
Failed to load extension 'AutoComplete'
Traceback (most recent call last):
File "C:\Programs\Python27\lib\idlelib\EditorWindow.py", line 1068, in load_standard_extensions
self.load_extension(name)
File "C:\Programs\Python27\lib\idlelib\EditorWindow.py", line 1083, in load_extension
cls = getattr(mod, name)
AttributeError: 'module' object has no attribute 'AutoComplete' Somehow AutoComplete was imported without an ImportError even though the class AutoComplete statement did not create the class asstribute. AutoComplete and CallTips are the two extensions containing "import __main__". Adding idlelib.__main__ somehow causes weird behavior in 2.7, though not in 3.x. Commenting out these imports removes the import problem.
Changing __main__.py to ... had no effect. I will add a reference to this issue in the file. (If should be removed if this issue is fixed.) |
New changeset 44fc6db34b69 by Terry Jan Reedy in branch '3.4': |
Why idlelib.__main__ should be backported? You can start IDLE as "python -m idlelib.idle" in 2.7 and this works as well in 3.x. |
The idea, obviously, is for python -m idlelib to also work on all systems. When this was requested as part of the discussion on another issue, I thought there was no idlelib.__main__ because __main__ did not work on 2.7. Someone corrected me and the expectation of me and others was that the absence was just an easily corrected oversight. Turns out not so. I wanted to at least document that the backport is not trivial. I am rather curious why the same code behaves so differently on 2.7. |
I am no longer patching IDLE for 2.7. |
I wanted this for the same reason you backported test.__main__ in bpo-30223, but I'm not going to fix the problems. |
bpo-27099 converts extensions, including autocomplete and calltips, to features. Buggy versions of the patch had similar import problems. After the PR is merged, I may try this again, and perhaps try moving the __main__ import into the functions that use it. |
cpython/Lib/idlelib/__main__.py Line 8 in 8f9c6fa
Should this be updated to the github issue no #68400? Or this comment can just be removed as 2.7 is long gone. |
Remove comment. |
Complete. |
(cherry picked from commit d9bf3c1) Co-authored-by: Stan Ulbrych <[email protected]>
(cherry picked from commit d9bf3c1) Co-authored-by: Stan Ulbrych <[email protected]>
(cherry picked from commit d9bf3c1) Co-authored-by: Stan Ulbrych <[email protected]>
(cherry picked from commit d9bf3c1) Co-authored-by: Stan Ulbrych <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
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:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: