[svn r37322] Turned out there was a function for this already, even... Thanks, fijal!
--HG-- branch : trunk
This commit is contained in:
parent
ed55fea143
commit
ba07a8769f
|
@ -1,6 +1,7 @@
|
|||
|
||||
import py
|
||||
from py.__.apigen.tracer import model
|
||||
from py.__.code.source import getsource
|
||||
|
||||
import types
|
||||
import inspect
|
||||
|
@ -18,20 +19,7 @@ class CallFrame(object):
|
|||
self.filename = frame.code.raw.co_filename
|
||||
self.lineno = frame.lineno
|
||||
self.firstlineno = frame.code.firstlineno
|
||||
|
||||
fname = frame.code.raw.co_filename
|
||||
if fname == '<string>':
|
||||
self.source = ''
|
||||
elif hasattr(fname, '__source__'):
|
||||
# is a py.code.Source object
|
||||
self.source = str(fname.__source__)
|
||||
# XXX should we do this?
|
||||
# self.filename = fname.split('<')[1].split('>')[0]
|
||||
else:
|
||||
try:
|
||||
self.source = frame.code.source()
|
||||
except IOError:
|
||||
raise IOError(self.filename)
|
||||
self.source = getsource(frame.code.raw)
|
||||
|
||||
def _getval(self):
|
||||
return (self.filename, self.lineno)
|
||||
|
|
Loading…
Reference in New Issue