Ticket #4530: fix_doctest_underscore_problem.diff
File fix_doctest_underscore_problem.diff, 1.3 KB (added by , 17 years ago) |
---|
-
_doctest.py
1239 1239 # __patched_linecache_getlines). 1240 1240 filename = '<doctest %s[%d]>' % (test.name, examplenum) 1241 1241 1242 # The exec statement with 'single' mode of compilation 1243 # overwrites the _ builtin. Store the original value so 1244 # that you can restore it later. 1245 original_underscore = __builtins__['_'] 1246 1242 1247 # Run the example in the given context (globs), and record 1243 1248 # any exception that gets raised. (But don't intercept 1244 1249 # keyboard interrupts.) … … 1249 1254 self.debugger.set_continue() # ==== Example Finished ==== 1250 1255 exception = None 1251 1256 except KeyboardInterrupt: 1257 __builtins__['_'] = original_underscore 1252 1258 raise 1253 1259 except: 1254 1260 exception = sys.exc_info() 1255 1261 self.debugger.set_continue() # ==== Example Finished ==== 1256 1262 1263 __builtins__['_'] = original_underscore 1264 1257 1265 got = self._fakeout.getvalue() # the actual output 1258 1266 self._fakeout.truncate(0) 1259 1267 outcome = FAILURE # guilty until proved innocent or insane