In Pdb, stop assigning values to __builtin__._ which interferes with the one commonly installed by gettext.
This commit is contained in:
parent
3864459196
commit
58b8b95cdb
|
@ -194,6 +194,12 @@ class Pdb(bdb.Bdb, cmd.Cmd):
|
||||||
self.cmdloop()
|
self.cmdloop()
|
||||||
self.forget()
|
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):
|
def default(self, line):
|
||||||
if line[:1] == '!': line = line[1:]
|
if line[:1] == '!': line = line[1:]
|
||||||
locals = self.curframe.f_locals
|
locals = self.curframe.f_locals
|
||||||
|
@ -202,13 +208,16 @@ class Pdb(bdb.Bdb, cmd.Cmd):
|
||||||
code = compile(line + '\n', '<stdin>', 'single')
|
code = compile(line + '\n', '<stdin>', 'single')
|
||||||
save_stdout = sys.stdout
|
save_stdout = sys.stdout
|
||||||
save_stdin = sys.stdin
|
save_stdin = sys.stdin
|
||||||
|
save_displayhook = sys.displayhook
|
||||||
try:
|
try:
|
||||||
sys.stdin = self.stdin
|
sys.stdin = self.stdin
|
||||||
sys.stdout = self.stdout
|
sys.stdout = self.stdout
|
||||||
|
sys.displayhook = self.displayhook
|
||||||
exec code in globals, locals
|
exec code in globals, locals
|
||||||
finally:
|
finally:
|
||||||
sys.stdout = save_stdout
|
sys.stdout = save_stdout
|
||||||
sys.stdin = save_stdin
|
sys.stdin = save_stdin
|
||||||
|
sys.displayhook = save_displayhook
|
||||||
except:
|
except:
|
||||||
t, v = sys.exc_info()[:2]
|
t, v = sys.exc_info()[:2]
|
||||||
if type(t) == type(''):
|
if type(t) == type(''):
|
||||||
|
|
|
@ -202,6 +202,9 @@ Core and Builtins
|
||||||
Library
|
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 #4572: added SEEK_* symbolic constants to io module.
|
||||||
|
|
||||||
- Issue #1665206 (partially): Move imports in cgitb to the top of the module
|
- Issue #1665206 (partially): Move imports in cgitb to the top of the module
|
||||||
|
|
Loading…
Reference in New Issue