self.cmdloop()
self.forget()
+ def displayhook(self, obj):
+ """Custom displayhook for the exec in default(), which prevents
+ assignment of the _ variable in the builtins.
+ """
+ print obj
+
def default(self, line):
if line[:1] == '!': line = line[1:]
locals = self.curframe.f_locals
code = compile(line + '\n', '<stdin>', 'single')
save_stdout = sys.stdout
save_stdin = sys.stdin
+ save_displayhook = sys.displayhook
try:
sys.stdin = self.stdin
sys.stdout = self.stdout
+ sys.displayhook = self.displayhook
exec code in globals, locals
finally:
sys.stdout = save_stdout
sys.stdin = save_stdin
+ sys.displayhook = save_displayhook
except:
t, v = sys.exc_info()[:2]
if type(t) == type(''):
Library
-------
+- In Pdb, prevent the reassignment of __builtin__._ by sys.displayhook on
+ printing out values.
+
- Issue #4572: added SEEK_* symbolic constants to io module.
- Issue #1665206 (partially): Move imports in cgitb to the top of the module