This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 2to3 truncates files at formfeed character
Type: Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, benjamin.peterson, cgohlke, python-dev
Priority: normal Keywords:

Created on 2011-02-19 23:57 by cgohlke, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
formfeedbug.py cgohlke, 2011-02-19 23:57
Messages (6)
msg128885 - (view) Author: Christoph Gohlke (cgohlke) Date: 2011-02-19 23:57
Running Tools/Scripts/2to3.py on Python 3.2rc3 or 2.7.1 for Windows on a file that contains a formfeed character (0x0C, <FF>) results in a truncated file. 

E.g. a file (attached) with the content

print 1
<FF>
print 2

is incorrectly refactored:

@@ -1,4 +1,1 @@
-print 1
-
-
-print 2
+print(1)


Python 2.6.6 and 3.1.3 correctly refactor the file:

-print 1
+print(1)
 <FF>
-print 2
+print(2)
msg129602 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-02-26 22:06
r88661
msg145046 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2011-10-06 22:28
Was this patch ever folded into Python 3.2?  Looking at the hg repository, I think the answer is "no".  It does appear to have made it into Python 2.7 and trunk though (afaict).

In point of fact, this bug is hitting me now with 3.2.2.
msg145095 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2011-10-07 16:15
I also noticed that test_parser.py isn't being run in either 3.2 or 3.3.  I'll fix that at the same time I port this patch to 3.2.
msg145118 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2011-10-07 18:02
Okay, re-enabling test_parser.py introduces a number of test failures in test_all_project_files().  Because I don't want to continue to shave the yak on this one, I'm going to wrap this test in @expectedFailure and open a separate bug for it.
msg145129 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-10-07 19:27
New changeset 6e0e9237d8e8 by Barry Warsaw in branch '3.2':
- Issue #11250: Back port fix from 3.3 branch, so that 2to3 can handle files
http://hg.python.org/cpython/rev/6e0e9237d8e8
History
Date User Action Args
2022-04-11 14:57:13adminsetgithub: 55459
2011-10-07 19:46:01barrysetstatus: open -> closed
2011-10-07 19:27:05python-devsetnosy: + python-dev
messages: + msg145129
2011-10-07 18:02:46barrysetmessages: + msg145118
2011-10-07 16:15:21barrysetassignee: barry
2011-10-07 16:15:10barrysetmessages: + msg145095
2011-10-06 22:28:06barrysetstatus: closed -> open
nosy: + barry
messages: + msg145046

2011-02-26 22:06:48benjamin.petersonsetstatus: open -> closed

messages: + msg129602
resolution: fixed
nosy: benjamin.peterson, cgohlke
2011-02-19 23:58:09pitrousetnosy: + benjamin.peterson
2011-02-19 23:57:36cgohlkesetcomponents: + 2to3 (2.x to 3.x conversion tool)
2011-02-19 23:57:24cgohlkecreate