[pypy-commit] pypy default: Translation patch by Juergen Boemmels.
arigo
noreply at buildbot.pypy.org
Fri Aug 26 05:54:56 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r46776:f6cc493a7f4c
Date: 2011-08-26 06:00 +0200
http://bitbucket.org/pypy/pypy/changeset/f6cc493a7f4c/
Log: Translation patch by Juergen Boemmels.
diff --git a/pypy/rlib/parsing/makepackrat.py b/pypy/rlib/parsing/makepackrat.py
--- a/pypy/rlib/parsing/makepackrat.py
+++ b/pypy/rlib/parsing/makepackrat.py
@@ -251,9 +251,11 @@
return "ErrorInformation(%s, %s)" % (self.pos, self.expected)
def get_line_column(self, source):
- uptoerror = source[:self.pos]
+ pos = self.pos
+ assert pos >= 0
+ uptoerror = source[:pos]
lineno = uptoerror.count("\n")
- columnno = self.pos - uptoerror.rfind("\n")
+ columnno = pos - uptoerror.rfind("\n")
return lineno, columnno
def nice_error_message(self, filename='<filename>', source=""):
More information about the pypy-commit
mailing list