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

Idle 2.7: update to simplify cross-version patches #62516

Closed
terryjreedy opened this issue Jun 27, 2013 · 4 comments
Closed

Idle 2.7: update to simplify cross-version patches #62516

terryjreedy opened this issue Jun 27, 2013 · 4 comments
Assignees

Comments

@terryjreedy
Copy link
Member

BPO 18316
Nosy @terryjreedy, @ncoghlan, @serwy
Files
  • differ23.py: difflib.Differ 2.7, 3.3 versions of idlelib file
  • 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 2017-06-19.23:54:51.664>
    created_at = <Date 2013-06-27.20:21:36.372>
    labels = ['expert-IDLE']
    title = 'Idle 2.7: update to simplify cross-version patches'
    updated_at = <Date 2019-03-21.04:53:35.963>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2019-03-21.04:53:35.963>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2017-06-19.23:54:51.664>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2013-06-27.20:21:36.372>
    creator = 'terry.reedy'
    dependencies = []
    files = ['30714']
    hgrepos = []
    issue_num = 18316
    keywords = []
    message_count = 4.0
    messages = ['191961', '191962', '192029', '296393']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'ncoghlan', 'roger.serwy', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue18316'
    versions = ['Python 2.7']

    @terryjreedy
    Copy link
    Member Author

    In a commiters-list discussion of heuristics for what patches can go into non-Idle 2.7, Nick Coghlan offered "simplifying cross-version maintenance". (He also mentioned "addressing issues that arise due to changes in the underlying platforms", which is another issue I will open.)

    Because of PEP-434 and the subsequent application of most Idle patches to all current versions, cross-version consistency is even more important for idlelib than the rest of the repository. When backporting patches, both context and changed lines must match. My experience so far is that merge conflicts are normal. So I think the latitude for consistency patches to reduce these should be even wider than for the rest of the repository. On the other hand, the current lack of tests suggests more caution than for the rest of the repository.

    For this issue, I would like to at least change "except exception, e:" to "except exception as e:". This is about as safe as anything, and grepping 2.7 idlelib for "except .*, *." yields 23 hits where the ',' is not for multiple exceptions.

    2.7 has about 80 print statements. While I would not change all in one patch (maybe 4), all in any file should be changed together when the future import is added at the top. Once this is done, forgetting to add parens or convert '>> file' results in a SyntaxError. So this is also pretty safe if the file compiles.

    Current uses of int() seem to be for str or float conversion, not a/b truncations. That is already done with a//b.

    There do not seem to be any unicode string literals.

    Have I forgotten any generic ways to make 2.7 code the same as 3.x?

    @terryjreedy
    Copy link
    Member Author

    I wrote a short script (already uploded) to differ 2.7 and 3.3 versions of an idlelib file. Applied to PyShell, I see unnecessary differences, like 'a,b' changed to 'a, b', or 'not a in b' changed to 'a not in b' only in 3.3 (probably for 3.0 when the necessary changes were made). When working on a particular file, I would be inclined to make the obvious updates to 2.7 first.

    @terryjreedy terryjreedy changed the title Idle 2.7: update to simply cross-version patches Idle 2.7: update to simplify cross-version patches Jun 27, 2013
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 29, 2013

    New changeset aa1350c7d196 by Terry Jan Reedy in branch '2.7':
    Issue bpo-18316: Update idlelib 2.7 except clauses to ease backports.
    http://hg.python.org/cpython/rev/aa1350c7d196

    @terryjreedy
    Copy link
    Member Author

    I am no longer patching IDLE for 2.7, partly because of the testing issue.

    @terryjreedy terryjreedy self-assigned this Mar 21, 2019
    @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
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant