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

Fix starting IDLE with pyshell #80610

Closed
terryjreedy opened this issue Mar 26, 2019 · 7 comments
Closed

Fix starting IDLE with pyshell #80610

terryjreedy opened this issue Mar 26, 2019 · 7 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 36429
Nosy @terryjreedy, @taleinat, @csabella, @miss-islington
PRs
  • bpo-36429: Fix starting IDLE with pyshell #12548
  • [3.7] bpo-36429: Fix starting IDLE with pyshell (GH-12548) #12570
  • 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 2019-06-16.19:07:44.902>
    created_at = <Date 2019-03-26.03:09:18.210>
    labels = ['3.8', 'expert-IDLE', 'type-bug', '3.7']
    title = 'Fix starting IDLE with pyshell'
    updated_at = <Date 2019-06-16.19:09:00.255>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2019-06-16.19:09:00.255>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2019-06-16.19:07:44.902>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2019-03-26.03:09:18.210>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36429
    keywords = ['patch']
    message_count = 7.0
    messages = ['338847', '338848', '338851', '338926', '338928', '345758', '345766']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'taleinat', 'cheryl.sabella', 'miss-islington']
    pr_nums = ['12548', '12570']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36429'
    versions = ['Python 3.7', 'Python 3.8']

    @terryjreedy
    Copy link
    Member Author

    python -m idlelib.pyshell # and
    python f:/dev/3x/lib/idlelib/pyshell.py # for instance
    no longer start IDLE properly. The separate subprocess startup command for when pyshell is the main, from 2004, is obsolete and no longer needed. The command needed is the same as for when IDLE is started otherwise. It works with either method of starting IDLE with pyshell.

    In addition, two modules are created from pyshell.py, with names '__main__' and 'idlelib.pyshell'. The attempt to prevent this should be at the top of the file instead of the bottem and now needs to add 'idlelib.pyshell' instead of 'pyshell'. The test for this was to (temporarily) add 'print('running')' at the top of the file and see if 'running\n' is printed to the terminal once or twice.

    An automated test might be done as follows:

    1. Move imports in main(), including that of 'testing', to top of file.
    2. Add, for instance, 'if testing: print('running') after the import.
    3. Mock main().
    4. Use test.support for 'with <captured stdout>: run pyshell.py'.
    5. Check captured stdout for exactly one 'running' occurrence.

    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 (EOL) end of life labels Mar 26, 2019
    @terryjreedy terryjreedy self-assigned this Mar 26, 2019
    @terryjreedy terryjreedy added topic-IDLE type-bug An unexpected behavior, bug, or error labels Mar 26, 2019
    @terryjreedy
    Copy link
    Member Author

    The shell actually 'starts', but with an empty box and no prompt.

    I am thinking of eventually deprecating and disabling starting with pyshell, but until we do, it should work. If nothing else, we should be able to display a deprecation notice if that becomes appropriate.

    The lack of reports does suggest that most affected people either switched to an approved method or another IDE.

    @terryjreedy
    Copy link
    Member Author

    One can start IDLE from python with import idlelib.idle or import idlelib.__main__ but not by importing pyshell, as there is alread a __main__ module. I cannot think of anything else to check.

    @terryjreedy
    Copy link
    Member Author

    New changeset 6a258c8 by Terry Jan Reedy in branch 'master':
    bpo-36429: Fix starting IDLE with pyshell (bpo-12548)
    6a258c8

    @miss-islington
    Copy link
    Contributor

    New changeset 23eb816 by Miss Islington (bot) in branch '3.7':
    bpo-36429: Fix starting IDLE with pyshell (GH-12548)
    23eb816

    @taleinat
    Copy link
    Contributor

    Terry, it looks like you merged a fix for this. Should this be closed?

    @terryjreedy
    Copy link
    Member Author

    Yep. I changes the headers but must have neglected to hit [Submit Changes].

    @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
    3.7 (EOL) end of life 3.8 (EOL) end of life topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants