[pypy-commit] pypy default: Fix an occasional IndexError.

arigo noreply at buildbot.pypy.org
Wed Dec 7 20:35:42 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r50285:80bbb425d34a
Date: 2011-12-07 20:34 +0100
http://bitbucket.org/pypy/pypy/changeset/80bbb425d34a/

Log:	Fix an occasional IndexError.

	(I should try to figure out if the trunk py lib still has the same
	issue, and write a test for it if it does, but I don't really follow
	the trunk py lib, so I'm just checking this here and it can be
	ignored if we update the py lib.)

diff --git a/py/_code/code.py b/py/_code/code.py
--- a/py/_code/code.py
+++ b/py/_code/code.py
@@ -164,6 +164,7 @@
         #   if something:  # assume this causes a NameError
         #      # _this_ lines and the one
                #        below we don't want from entry.getsource()
+        end = min(end, len(source))
         for i in range(self.lineno, end):
             if source[i].rstrip().endswith(':'):
                 end = i + 1


More information about the pypy-commit mailing list