[Python-bugs-list] DeprecationWarning line number off-by-one

Python Bugs python-bugs at shopip.com
Mon Sep 8 16:14:44 EDT 2003


Python bug summary: DeprecationWarning line number is off-by-one when the offending character is within multi-line (triple quoted) string.

To reproduce: Create a source file with:

"""
spam
text with non-ASCII character (\x80 to \xFF)
spam
"""

Then execute to produce:
DeprecationWarning: Non-ASCII character '\xxx' in file x on line 4, but no encoding declared;...

(The character is actually on line 3.)

NOTE: I do not think this warning should even be given for text within quotes.



More information about the Python-bugs-list mailing list