[svn r60141] refactor things such that all fallbacks to inspect.get/findsource happen in helpers in source.py

--HG--
branch : trunk
This commit is contained in:
pedronis
2008-11-25 19:34:47 +01:00
parent 5c8b04dacb
commit 1a150e9050
6 changed files with 71 additions and 23 deletions

View File

@@ -51,19 +51,9 @@ class TracebackEntry(object):
def getsource(self):
""" return failing source code. """
try:
source = self.frame.code.fullsource
except (IOError, py.error.ENOENT):
return None
source = self.frame.code.fullsource
if source is None:
try:
sourcelines, lineno = py.std.inspect.findsource(self.frame.code.raw)
except (KeyboardInterrupt, SystemExit):
raise
except:
return None
source = py.code.Source()
source.lines = map(str.rstrip, sourcelines)
return None
start = self.getfirstlinesource()
end = self.lineno
try: