##// END OF EJS Templates
Reapply our monkeypatch to inspect.findsource()....
Thomas Kluyver -
Show More
@@ -126,15 +126,10 b' def inspect_error():'
126 126 error('Internal Python error in the inspect module.\n'
127 127 'Below is the traceback from this internal error.\n')
128 128
129
130 # N.B. This function is a monkeypatch we are currently not applying.
131 # It was written some time ago, to fix an apparent Python bug with
132 # codeobj.co_firstlineno . Unfortunately, we don't know under what conditions
133 # the bug occurred, so we can't tell if it has been fixed. If it reappears, we
134 # will apply the monkeypatch again. Also, note that findsource() is not called
135 # by our code at this time - we don't know if it was when the monkeypatch was
136 # written, or if the monkeypatch is needed for some other code (like a debugger).
137 # For the discussion about not applying it, see gh-1229. TK, Jan 2011.
129 # This function is a monkeypatch we apply to the Python inspect module. We have
130 # now found when it's needed (see discussion on issue gh-1456), and we have a
131 # test case (IPython.core.tests.test_ultratb.ChangedPyFileTest) that fails if
132 # the monkeypatch is not applied. TK, Aug 2012.
138 133 def findsource(object):
139 134 """Return the entire source file and starting line number for an object.
140 135
@@ -210,10 +205,8 b' def findsource(object):'
210 205 return lines, lnum
211 206 raise IOError('could not find code object')
212 207
213 # Not applying the monkeypatch - see above the function for details. TK, Jan 2012
214 # Monkeypatch inspect to apply our bugfix. This code only works with py25
215 #if sys.version_info[:2] >= (2,5):
216 # inspect.findsource = findsource
208 # Monkeypatch inspect to apply our bugfix. This code only works with Python >= 2.5
209 inspect.findsource = findsource
217 210
218 211 def fix_frame_records_filenames(records):
219 212 """Try to fix the filenames in each record from inspect.getinnerframes().
General Comments 0
You need to be logged in to leave comments. Login now