msg333945 - (view) |
Author: Karthikeyan Singaravelan (xtreak) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2019-01-18 06:42 |
I used to launch IDLE using from master using ./python.exe -m idlelib . It used to work but fails on master on Mac OS now. There seems to be some discussion about this on msg332672 after the commit c1b4b0f6160e1919394586f44b12538505fed300. Feel free to close this if it's a known issue. I haven't tested it on latest 3.7 but it seems the commit was also merged to 3.7 so I am just adding 3.8 as version.
Mac OS version : 10.10.4
➜ cpython git:(master) ✗ git checkout c1b4b0f6160e1919394586f44b12538505fed300 Lib/idlelib && ./python.exe -m idlelib
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/idlelib/__main__.py", line 7, in <module>
idlelib.pyshell.main()
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/idlelib/pyshell.py", line 1507, in main
macosx.setupApp(root, flist)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/idlelib/macosx.py", line 280, in setupApp
overrideRootMenu(root, flist)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/idlelib/macosx.py", line 181, in overrideRootMenu
del mainmenu.menudefs[-2][1][0]
IndexError: list assignment index out of range
➜ cpython git:(master) ✗ git checkout c1b4b0f6160e1919394586f44b12538505fed300~1 Lib/idlelib && ./python.exe -m idlelib # Works
$ git show c1b4b0f6160e1919394586f44b12538505fed300
commit c1b4b0f6160e1919394586f44b12538505fed300 (bpo35557, 35559)
Author: Cheryl Sabella <cheryl.sabella@gmail.com>
Date: Sat Dec 22 01:25:45 2018 -0500
bpo-22703: IDLE: Improve Code Context and Zoom Height menu labels (GH-11214)
The Code Context menu label now toggles between Show/Hide Code Context.
The Zoom Height menu now toggles between Zoom/Restore Height.
Zoom Height has moved from the Window menu to the Options menu.
https://bugs.python.org/issue22703
|
msg333950 - (view) |
Author: Terry J. Reedy (terry.reedy) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2019-01-18 08:15 |
Thank you for the report. The error line "del mainmenu.menudefs[-2][1][0]" follows this comment.
# Remove the 'Configure Idle' entry from the options menu, it is in the
# application menu as 'Preferences'
However, -2 is the Window menu, while Options is -3. Before the c1b patch, Window started with one entry, Zoom Height. This explains why 'Configure IDLE' is still present, and Zoom Height is absent. I did not notice the latter gone before because there is an Apple-supplied Zoom entry, which maximizes width as well as height. I did not notice that this was a replacement.
After the patch, Window starts empty, which is why even index 0 fails. So try changing -2 to -3 in macosx, getting [-3][1][0] and see if everything works.
When the dialog is removed, the menu will start with a separator bar. It should go to. So next try [-3][1][0:1]
|
msg333953 - (view) |
Author: Karthikeyan Singaravelan (xtreak) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2019-01-18 08:38 |
Thanks, I can confirm that your fix launches idlelib.
Not working : del mainmenu.menudefs[-2][1][0]
Working : del mainmenu.menudefs[-3][1][0]
Options menu listing on master with the fix with "Show code context" disabled.
- Show code context
- Zoom height
git checkout v3.7.2 Lib/idlelib/ also works fine so I guess it's a regression but I don't know if this affects other versions of Mac OS.
Options menu listing on 3.7.2
- Configure IDLE
- Code Context
|
msg333959 - (view) |
Author: Cheryl Sabella (cheryl.sabella) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2019-01-18 12:43 |
Karthikeyan,
Thanks for catching this! Did you want to submit the patch for it or did you want me to make the PR? We're still working on the tests for the menus, so this would just be a code change.
|
msg333960 - (view) |
Author: Karthikeyan Singaravelan (xtreak) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2019-01-18 12:58 |
Cheryl, feel free to submit a patch since I have less exposure to IDLE code. I can manually test the PR on my Mac and report back since this seems to be a Mac specific patch. It would be helpful if someone with access to other Mac OS versions can possibly test this so that it doesn't cause issues on other versions.
Applying the fix suggested by Terry on my machine and running tests
$ git diff | cat
diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py
index 9be4ed2ec4..16a13a0f2e 100644
--- a/Lib/idlelib/macosx.py
+++ b/Lib/idlelib/macosx.py
@@ -178,7 +178,7 @@ def overrideRootMenu(root, flist):
del mainmenu.menudefs[-1][1][0:2]
# Remove the 'Configure Idle' entry from the options menu, it is in the
# application menu as 'Preferences'
- del mainmenu.menudefs[-2][1][0]
+ del mainmenu.menudefs[-3][1][0]
menubar = Menu(root)
root.configure(menu=menubar)
menudict = {}
$ ./python.exe -m unittest idlelib.idle_test
sss......s..........................ss..ss...............................s.......s.............s.sssss...........s.ss..sss.ss....sss..s..s..s...s.....s.s.s................s..s........ss.........ssss.................ssss...................sssssss..s.sss...ss...........sssss.....s.s
----------------------------------------------------------------------
Ran 241 tests in 1.246s
OK (skipped=66)
|
msg333989 - (view) |
Author: Terry J. Reedy (terry.reedy) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2019-01-18 16:48 |
Since it is my fix, I will write the PR. But first, please test part 2, changing '0' to '0:1', just to make sure it works.
c1b added 'None,' (for separater bar) after the configdialog entry. When the configdialog entry is removed, the None should be also. On Windows, a menu that starts with None starts with a visible bar. On my Mac Mohave, and perhaps on your machine, it is supressed. But a) I would rather have the data structure match what is shown, and b) we cannot know if the supression occurs on all versions of macOS and predecessors.
|
msg333993 - (view) |
Author: Cheryl Sabella (cheryl.sabella) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2019-01-18 16:55 |
Terry,
I've started working on a PR to change menudefs to a dictionary. Since dictionaries are in guaranteed order now, it would be easier to reference the menus by their name instead of an index number.
|
msg333995 - (view) |
Author: Karthikeyan Singaravelan (xtreak) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2019-01-18 17:13 |
> Since it is my fix, I will write the PR. But first, please test part 2, changing '0' to '0:1', just to make sure it works.
Just tested it and it works fine with slice. Please find the respective diff and options menu displayed as below :
git diff | cat
diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py
index 9be4ed2ec4..16a13a0f2e 100644
--- a/Lib/idlelib/macosx.py
+++ b/Lib/idlelib/macosx.py
@@ -178,7 +178,7 @@ def overrideRootMenu(root, flist):
del mainmenu.menudefs[-1][1][0:2]
# Remove the 'Configure Idle' entry from the options menu, it is in the
# application menu as 'Preferences'
- del mainmenu.menudefs[-2][1][0]
+ del mainmenu.menudefs[-3][1][0]
menubar = Menu(root)
root.configure(menu=menubar)
menudict = {}
Options menu
- Show code context (disabled)
- Zoom height
git diff | cat
diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py
index 9be4ed2ec4..d6a1b376a1 100644
--- a/Lib/idlelib/macosx.py
+++ b/Lib/idlelib/macosx.py
@@ -178,7 +178,7 @@ def overrideRootMenu(root, flist):
del mainmenu.menudefs[-1][1][0:2]
# Remove the 'Configure Idle' entry from the options menu, it is in the
# application menu as 'Preferences'
- del mainmenu.menudefs[-2][1][0]
+ del mainmenu.menudefs[-3][1][0:1]
menubar = Menu(root)
root.configure(menu=menubar)
menudict = {}
Options menu
- Show code context (disabled)
- Zoom height
|
msg333998 - (view) |
Author: Terry J. Reedy (terry.reedy) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2019-01-18 17:46 |
Cheryl, that sort of change needs an issue for discussion before going very far. I am dubious that it will work (but you can try to show otherwise).
1. overrideRootMenu does an insertion that I don't think you can do with a dict.
mainmenu.menudefs[0][1].insert(6, closeItem)
2. The structure of menudefs is part of the extension interface. (The file should say so.) The test extension zzdummy is incomplete. test_zzdummy has not yet been written, and the definition of ZaDummy.menudefs, currently commented out, needs to me made conditional on whether tests are being run (__init__.testing)
|
msg334001 - (view) |
Author: Cheryl Sabella (cheryl.sabella) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2019-01-18 18:32 |
I'll submit a quick PR as a PoC. Tal emailed with additional ideas about menudefs, so I agree that another issue would probably be suitable for more discussion.
I haven't looked at the extensions too closely yet, but the insert you're referring to is actually on the 'values' part, so it's not an issue.
mainmenu.menudefs[0][1] refers to menu item 0 (file menu) and the [1] means the nested list of tuples within menu 0. I learned that while converting to a dict.
A trickier one is this because it changes the menus:
mainmenu.menudefs.insert(0,
('application', [
('About IDLE', '<<about-idle>>'),
None,
]))
But I think this will work for that:
appmenu = {'application': [
('About IDLE', '<<about-idle>>'),
None,
]}
mainmenu.menudefs = {**appmenu, **mainmenu.menudefs}
|
msg334003 - (view) |
Author: Terry J. Reedy (terry.reedy) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2019-01-18 19:00 |
New changeset 39ed289a3511d2e9bf0950a9d5dc53c8194f61b9 by Terry Jan Reedy in branch 'master':
bpo-35770: IDLE macosx deletes Options => Configure IDLE. (GH-11614)
https://github.com/python/cpython/commit/39ed289a3511d2e9bf0950a9d5dc53c8194f61b9
|
msg334004 - (view) |
Author: miss-islington (miss-islington) |
Date: 2019-01-18 19:16 |
New changeset a01e23559fd77083a2c6c59692b70d7896e5f59a by Miss Islington (bot) in branch '3.7':
bpo-35770: IDLE macosx deletes Options => Configure IDLE. (GH-11614)
https://github.com/python/cpython/commit/a01e23559fd77083a2c6c59692b70d7896e5f59a
|
msg334016 - (view) |
Author: Terry J. Reedy (terry.reedy) * ![Python committer (Python committer)](@@file/committer.png) |
Date: 2019-01-18 22:05 |
New changeset 2cf1ddaff4c869780d9e796b21ef3e506f8ad321 by Terry Jan Reedy in branch 'master':
bpo-35770: Fix off-by-1 error. (#11618)
https://github.com/python/cpython/commit/2cf1ddaff4c869780d9e796b21ef3e506f8ad321
|
msg334018 - (view) |
Author: miss-islington (miss-islington) |
Date: 2019-01-18 22:23 |
New changeset 47290e7642dd41d94437dd0e2c0f6bfceb0281b5 by Miss Islington (bot) in branch '3.7':
bpo-35770: Fix off-by-1 error. (GH-11618)
https://github.com/python/cpython/commit/47290e7642dd41d94437dd0e2c0f6bfceb0281b5
|
|
Date |
User |
Action |
Args |
2022-04-11 14:59:10 | admin | set | github: 79951 |
2019-01-18 22:29:33 | terry.reedy | set | pull_requests:
- pull_request11367 |
2019-01-18 22:29:17 | terry.reedy | set | pull_requests:
- pull_request11368 |
2019-01-18 22:23:55 | miss-islington | set | messages:
+ msg334018 |
2019-01-18 22:06:19 | miss-islington | set | pull_requests:
+ pull_request11368 |
2019-01-18 22:06:07 | miss-islington | set | pull_requests:
+ pull_request11367 |
2019-01-18 22:05:56 | miss-islington | set | pull_requests:
+ pull_request11366 |
2019-01-18 22:05:43 | terry.reedy | set | messages:
+ msg334016 |
2019-01-18 21:35:59 | terry.reedy | set | pull_requests:
- pull_request11364 |
2019-01-18 21:35:43 | terry.reedy | set | pull_requests:
- pull_request11365 |
2019-01-18 21:34:24 | terry.reedy | set | pull_requests:
+ pull_request11365 |
2019-01-18 21:34:17 | terry.reedy | set | pull_requests:
+ pull_request11364 |
2019-01-18 21:34:08 | terry.reedy | set | pull_requests:
+ pull_request11363 |
2019-01-18 20:19:06 | terry.reedy | set | keywords:
patch, patch, patch status: open -> closed resolution: fixed stage: patch review -> resolved |
2019-01-18 20:12:10 | terry.reedy | set | pull_requests:
- pull_request11358 |
2019-01-18 20:11:49 | terry.reedy | set | pull_requests:
- pull_request11359 |
2019-01-18 20:11:26 | terry.reedy | set | pull_requests:
- pull_request11356 |
2019-01-18 20:10:58 | terry.reedy | set | pull_requests:
- pull_request11355 |
2019-01-18 20:10:35 | terry.reedy | set | pull_requests:
- pull_request11353 |
2019-01-18 20:10:17 | terry.reedy | set | pull_requests:
- pull_request11352 |
2019-01-18 19:16:04 | miss-islington | set | nosy:
+ miss-islington messages:
+ msg334004
|
2019-01-18 19:01:25 | miss-islington | set | pull_requests:
+ pull_request11359 |
2019-01-18 19:01:19 | miss-islington | set | pull_requests:
+ pull_request11358 |
2019-01-18 19:01:13 | miss-islington | set | pull_requests:
+ pull_request11357 |
2019-01-18 19:00:48 | terry.reedy | set | messages:
+ msg334003 |
2019-01-18 18:35:35 | cheryl.sabella | set | stage: needs patch -> patch review pull_requests:
+ pull_request11356 |
2019-01-18 18:35:28 | cheryl.sabella | set | stage: needs patch -> needs patch pull_requests:
+ pull_request11355 |
2019-01-18 18:35:20 | cheryl.sabella | set | stage: needs patch -> needs patch pull_requests:
+ pull_request11354 |
2019-01-18 18:32:50 | cheryl.sabella | set | messages:
+ msg334001 stage: patch review -> needs patch |
2019-01-18 18:08:18 | terry.reedy | set | keywords:
+ patch stage: needs patch -> patch review pull_requests:
+ pull_request11353 |
2019-01-18 18:08:10 | terry.reedy | set | keywords:
+ patch stage: needs patch -> needs patch pull_requests:
+ pull_request11352 |
2019-01-18 18:08:00 | terry.reedy | set | keywords:
+ patch stage: needs patch -> needs patch pull_requests:
+ pull_request11351 |
2019-01-18 17:46:05 | terry.reedy | set | messages:
+ msg333998 |
2019-01-18 17:13:40 | xtreak | set | messages:
+ msg333995 |
2019-01-18 16:55:59 | cheryl.sabella | set | messages:
+ msg333993 |
2019-01-18 16:48:02 | terry.reedy | set | messages:
+ msg333989 |
2019-01-18 12:58:50 | xtreak | set | messages:
+ msg333960 |
2019-01-18 12:43:24 | cheryl.sabella | set | messages:
+ msg333959 |
2019-01-18 08:38:47 | xtreak | set | messages:
+ msg333953 |
2019-01-18 08:15:43 | terry.reedy | set | type: behavior stage: needs patch messages:
+ msg333950 versions:
+ Python 3.7 |
2019-01-18 06:42:07 | xtreak | create | |