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: trace.py and CR at EOL
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: skip.montanaro Nosy List: felixwiemann, quiver, skip.montanaro
Priority: normal Keywords: patch

Created on 2004-04-14 14:32 by felixwiemann, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
trace.py.patch felixwiemann, 2004-04-14 14:32 Patch for trace.py
Messages (4)
msg45764 - (view) Author: Felix Wiemann (felixwiemann) Date: 2004-04-14 14:32
trace.py has problems with carriage returns on Unix systems
when using the --missing switch:


$ cat -v test.py
print "Hello"^M
print "World!"^M

Note the carriage returns.

$ python test.py
Hello
World!

Works fine.

$ python /usr/lib/python2.3/trace.py --count
--coverdir=. --missing test.py
Hello
World!
Traceback (most recent call last):
  File "/usr/lib/python2.3/trace.py", line 690, in ?
    main()
  File "/usr/lib/python2.3/trace.py", line 687, in main
    results.write_results(missing, summary=summary,
coverdir=coverdir)
  File "/usr/lib/python2.3/trace.py", line 264, in
write_results
    lnotab = find_executable_linenos(filename)
  File "/usr/lib/python2.3/trace.py", line 389, in
find_executable_linenos
    code = compile(prog, filename, "exec")
  File "test.py", line 1
    print "Hello"
                 ^
SyntaxError: invalid syntax

When using trace.py with the --missing switch, it complains
about the carriage returns.


The attached patch fixes the problem.
msg45765 - (view) Author: Felix Wiemann (felixwiemann) Date: 2004-04-14 15:04
Logged In: YES 
user_id=1014490

Assigned to montanaro, looks like he is the right one.
msg45766 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2004-04-16 03:29
Logged In: YES 
user_id=44345

Thanks.  Applied to trace.py 1.21.  Will backport to 2.3 branch.
msg45767 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2004-04-18 03:02
Logged In: YES 
user_id=671362

Hi, Skip.
I've submitted a similar patch before.

patch # 924771 ``work around to compile \r\n file''.
http://www.python.org/sf/924771

Can you review it also?
The problem and the solution is the same as Felix.
History
Date User Action Args
2022-04-11 14:56:03adminsetgithub: 40149
2004-04-14 14:32:12felixwiemanncreate