diff options
author | 2012-10-22 16:27:21 +0200 | |
---|---|---|
committer | 2012-10-22 16:27:21 +0200 | |
commit | a3b03616b818ab78033ff452d16cdc3808a1187c (patch) | |
tree | e8c120e990a2adc602af90cfeabcf031c0f00719 /py | |
parent | use memcpy one more time in array.__delslice__ for extra speediness (diff) | |
download | pypy-a3b03616b818ab78033ff452d16cdc3808a1187c.tar.gz pypy-a3b03616b818ab78033ff452d16cdc3808a1187c.tar.bz2 pypy-a3b03616b818ab78033ff452d16cdc3808a1187c.zip |
try to mitigate "it takes forever" on py.test
Diffstat (limited to 'py')
-rw-r--r-- | py/_code/source.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/py/_code/source.py b/py/_code/source.py index 12f6b1aec7..802f9f5639 100644 --- a/py/_code/source.py +++ b/py/_code/source.py @@ -118,7 +118,7 @@ class Source(object): # 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 @@ class Source(object): 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 |