classification
Title: Idle 2.7: update to simplify cross-version patches
Type: Stage: resolved
Components: IDLE Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: ncoghlan, python-dev, roger.serwy, terry.reedy
Priority: normal Keywords:

Created on 2013-06-27 20:21 by terry.reedy, last changed 2019-03-21 04:53 by terry.reedy. This issue is now closed.

Files
File name Uploaded Description Edit
differ23.py terry.reedy, 2013-06-27 20:21 difflib.Differ 2.7, 3.3 versions of idlelib file
Messages (4)
msg191961 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-06-27 20:21
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?
msg191962 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-06-27 20:28
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.
msg192029 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-06-29 04:59
New changeset aa1350c7d196 by Terry Jan Reedy in branch '2.7':
Issue #18316: Update idlelib 2.7 except clauses to ease backports.
http://hg.python.org/cpython/rev/aa1350c7d196
msg296393 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-19 23:54
I am no longer patching IDLE for 2.7, partly because of the testing issue.
History
Date User Action Args
2019-03-21 04:53:35terry.reedysetassignee: terry.reedy
components: + IDLE
2017-06-19 23:54:51terry.reedysetstatus: open -> closed
resolution: out of date
messages: + msg296393

stage: needs patch -> resolved
2013-06-29 04:59:55python-devsetnosy: + python-dev
messages: + msg192029
2013-06-27 20:32:01terry.reedysettitle: Idle 2.7: update to simply cross-version patches -> Idle 2.7: update to simplify cross-version patches
2013-06-27 20:28:53terry.reedysetmessages: + msg191962
2013-06-27 20:21:36terry.reedycreate