Fix a small problem with rfind() methods.

This commit is contained in:
Georg Brandl 2009-04-10 11:10:38 +02:00
parent 1127319ca5
commit b966975ca6

View File

@ -534,7 +534,7 @@ class BuildEnvironment:
"""
Custom decoding error handler that warns and replaces.
"""
linestart = error.object.rfind('\n', None, error.start)
linestart = error.object.rfind('\n', 0, error.start)
lineend = error.object.find('\n', error.start)
if lineend == -1: lineend = len(error.object)
lineno = error.object.count('\n', 0, error.start) + 1