[pypy-commit] pypy default: try to mitigate "it takes forever" on py.test
fijal
noreply at buildbot.pypy.org
Mon Oct 22 16:49:57 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r58361:f8388bb30d71
Date: 2012-10-22 16:27 +0200
http://bitbucket.org/pypy/pypy/changeset/f8388bb30d71/
Log: try to mitigate "it takes forever" on py.test
diff --git a/py/_code/source.py b/py/_code/source.py
--- a/py/_code/source.py
+++ b/py/_code/source.py
@@ -118,7 +118,7 @@
# 1. find the start of the statement
from codeop import compile_command
end = None
- for start in range(lineno, -1, -1):
+ for start in range(lineno, -1, max(-1, lineno - 10)):
if assertion:
line = self.lines[start]
# the following lines are not fully tested, change with care
@@ -135,9 +135,9 @@
compile_command(trysource)
except (SyntaxError, OverflowError, ValueError):
continue
-
+
# 2. find the end of the statement
- for end in range(lineno+1, len(self)+1):
+ for end in range(lineno+1, min(len(self)+1, lineno + 10)):
trysource = self[start:end]
if trysource.isparseable():
return start, end
More information about the pypy-commit
mailing list