[issue21477] Idle: improve idle_test.htest

Terry J. Reedy report at bugs.python.org
Sun May 25 00:41:04 CEST 2014


Terry J. Reedy added the comment:

Since I wanted to get this large patch applied as a basis for further work, I went ahead with the 2.7 backport. I am listing the issues in converting run-runall-34.diff to run-runall-27.diff to help Saimadhav do this in the future.

1. /tkinter/Tkinter/ 7 places (easy).

2. /print(xxx)/print xxx/ 3 places in 2 idlelib files,
but leave print(widget.result) alone in htest

3. /importlib.machinery/imp/ in Pathbrowser.py

4. In textView.py, the 2.7 line
    text = file(filename, 'r').read()
was changed in 3.x to two lines:
    with open(filename, 'r') as f:
        text = f.read()
Since inserting or deleting a line in a diff file (as opposed to the within-line edits above) is tricky, and since this line is part of a chunk being deleted, I left this alone in the -27.diff resulting from the changes above. The diff uploaded included the handpatch changes.

(Note: some time ago, I converted all open statements to 'with open' in 2.7 and 3.x. I did not think of 'file(' as a synonym for 'open('. Any other uses of 'file(' should be converted also.)

5. The surprise I had forgotten about. 'nonlocal', used in the new version of run(), is new in 3.0! Fortunately, I remember the ugly hack we used in 2.x. It does mean, however, that the run code is different in 2.7. Future patches to run should only patch run().

6. ColorDelegator: the code in the 3.x test is displayed for me as
ó
チSc
I replaced source with a string literal. I think we should use a revised version of this, with everything that should be colored, in 3.x also and skip the file read.

----------
Added file: http://bugs.python.org/file35343/run-runall-27.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21477>
_______________________________________


More information about the Python-bugs-list mailing list