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

Force not using _default_root in IDLE #68325

Closed
serhiy-storchaka opened this issue May 6, 2015 · 15 comments
Closed

Force not using _default_root in IDLE #68325

serhiy-storchaka opened this issue May 6, 2015 · 15 comments
Assignees
Labels
topic-IDLE topic-tkinter type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 24137
Nosy @terryjreedy, @kbkaiser, @serwy, @vadmium, @serhiy-storchaka
Files
  • nodefaultroot.diff
  • nodefaultroot2.diff
  • nodefaultroot3.diff
  • nodefaultroot4.diff
  • 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 2016-06-21.22:43:58.694>
    created_at = <Date 2015-05-06.15:26:17.203>
    labels = ['expert-IDLE', 'type-feature', 'expert-tkinter']
    title = 'Force not using _default_root in IDLE'
    updated_at = <Date 2018-06-27.02:17:09.315>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2018-06-27.02:17:09.315>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2016-06-21.22:43:58.694>
    closer = 'terry.reedy'
    components = ['IDLE', 'Tkinter']
    creation = <Date 2015-05-06.15:26:17.203>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['43483', '43489', '43497', '43500']
    hgrepos = []
    issue_num = 24137
    keywords = ['patch']
    message_count = 15.0
    messages = ['242680', '268873', '268888', '268901', '268902', '268979', '269028', '269033', '269254', '269255', '269265', '271207', '271224', '272821', '320530']
    nosy_count = 6.0
    nosy_names = ['terry.reedy', 'kbk', 'roger.serwy', 'python-dev', 'martin.panter', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue24137'
    versions = ['Python 3.6']

    @serhiy-storchaka
    Copy link
    Member Author

    Perhaps explicitly calling NoDefaultRoot() in IDLE will help to catch some possible bugs (in IDLE or in Tkinter). It should be called only when IDLE is ran in subprocess mode, so it will not affect user code that uses Tkinter. _default_root is used mainly for interactive experiments with Tkinter.

    It is worth also to call NoDefaultRoot() in IDLE tests (see Tkinter tests as a guide).

    @serhiy-storchaka serhiy-storchaka added topic-IDLE topic-tkinter type-feature A feature request or enhancement labels May 6, 2015
    @serhiy-storchaka
    Copy link
    Member Author

    What your thoughts about this Terry?

    @terryjreedy
    Copy link
    Member

    Time to do it, at least for tests. I think patch is ready to push, with running without default root disabled until I do more testing. In particular, reread in Rietveld, do suggested actions when run through htest, and try all menu items.

    @terryjreedy terryjreedy self-assigned this Jun 20, 2016
    @serhiy-storchaka
    Copy link
    Member Author

    I ran IDLE and tests and found yet few needed changes.

    NoDefaultRoot() should be called only if run IDLE with a subprocess support.

    @serhiy-storchaka
    Copy link
    Member Author

    And I thing changes to tests can be applied to all versions (especially since they become diverge), but NoDefaultRoot() should be called in IDLE only in 3.6.

    @terryjreedy
    Copy link
    Member

    I made htest run without default root, just list test_idel, and found a few more. I grepped for 'Toplevel()'. Also for bad Tk() calls.

    I still need to move the call in pyshell and check this over. But I think it close.

    @terryjreedy
    Copy link
    Member

    Conditioned NoDefaultRoot() on use_subprocess. Ran through menu. Will push soon after rechecking patches with Rietveld.

    Thanks for the additional review. I don't know that this caught any real bugs in IDLE itself. But many of the htests needed upgrading to consistently use a Toplevel with the exiting root as parent (and never start a second mainloop). Not worth backporting en masse though.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 21, 2016

    New changeset 064b29dde096 by Terry Jan Reedy in branch 'default':
    Issue bpo-24137: Run IDLE, test_idle, and htest with tkinter default root disabled.
    https://hg.python.org/cpython/rev/064b29dde096

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 25, 2016

    New changeset a8d611eb6173 by Serhiy Storchaka in branch 'default':
    Issue bpo-24137: Fixed IDLE on Linux with tkinter default root disabled.
    https://hg.python.org/cpython/rev/a8d611eb6173

    @serhiy-storchaka
    Copy link
    Member Author

    You have missed my changes in nodefaultroot2.diff.

    @terryjreedy
    Copy link
    Member

    Using Rietveld to make a 1-2 diff for each file, it appears you made 3 changes. I incorporated 2, and missed 1 (which you just pushed). I believe I incorporated your changes by hand because I had already made additional changes myself. I suspect that at that time I failed to middle-click the '1' for 'pyshell' hard enough to get the 1-2 diff for pyshell. I should have counted and checked to make sure I had all 8 diffs.

    @vadmium
    Copy link
    Member

    vadmium commented Jul 25, 2016

    It seems this change causes test_tix to fail for me; see bpo-27611

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 25, 2016

    New changeset 5c76f787e695 by Terry Jan Reedy in branch 'default':
    Issue bpo-24137, issue bpo-27611: Restore tkinter after test_idle.
    https://hg.python.org/cpython/rev/5c76f787e695

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 16, 2016

    New changeset a6a248479b66 by Terry Jan Reedy in branch 'default':
    Issue bpo-27611, bpo-24137: Only change tkinter when easily restored.
    https://hg.python.org/cpython/rev/a6a248479b66

    @terryjreedy
    Copy link
    Member

    The net effect of this issue:

    pyshell.main calls NoDefaultRoot() when running normally, when using a subprocess and testing is not set. It does not call it when in -n mode since that would affect users.

    idle_test.htest calls NoDefaultRoot() unconditionally. pyshell.main is not called.

    test.test_idle sets testing to avoid the call when run by test.regrtest, to avoid failing the latter's changed-environment check. But it does call NoDefaultRoot when run as __main__ and the tests are run by unittest.main.

    Known dependencies on a default root have been removed. It is unlikely that any are left.

    @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
    topic-IDLE topic-tkinter type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants