Show More
@@ -126,15 +126,10 b' def inspect_error():' | |||||
126 | error('Internal Python error in the inspect module.\n' |
|
126 | error('Internal Python error in the inspect module.\n' | |
127 | 'Below is the traceback from this internal error.\n') |
|
127 | 'Below is the traceback from this internal error.\n') | |
128 |
|
128 | |||
129 |
|
129 | # This function is a monkeypatch we apply to the Python inspect module. We have | ||
130 | # N.B. This function is a monkeypatch we are currently not applying. |
|
130 | # now found when it's needed (see discussion on issue gh-1456), and we have a | |
131 | # It was written some time ago, to fix an apparent Python bug with |
|
131 | # test case (IPython.core.tests.test_ultratb.ChangedPyFileTest) that fails if | |
132 | # codeobj.co_firstlineno . Unfortunately, we don't know under what conditions |
|
132 | # the monkeypatch is not applied. TK, Aug 2012. | |
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. |
|
|||
138 | def findsource(object): |
|
133 | def findsource(object): | |
139 | """Return the entire source file and starting line number for an object. |
|
134 | """Return the entire source file and starting line number for an object. | |
140 |
|
135 | |||
@@ -210,10 +205,8 b' def findsource(object):' | |||||
210 | return lines, lnum |
|
205 | return lines, lnum | |
211 | raise IOError('could not find code object') |
|
206 | raise IOError('could not find code object') | |
212 |
|
207 | |||
213 | # Not applying the monkeypatch - see above the function for details. TK, Jan 2012 |
|
208 | # Monkeypatch inspect to apply our bugfix. This code only works with Python >= 2.5 | |
214 | # Monkeypatch inspect to apply our bugfix. This code only works with py25 |
|
209 | inspect.findsource = findsource | |
215 | #if sys.version_info[:2] >= (2,5): |
|
|||
216 | # inspect.findsource = findsource |
|
|||
217 |
|
210 | |||
218 | def fix_frame_records_filenames(records): |
|
211 | def fix_frame_records_filenames(records): | |
219 | """Try to fix the filenames in each record from inspect.getinnerframes(). |
|
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