summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-04-01 21:54:21 (GMT)
committerGeorg Brandl <georg@python.org>2009-04-01 21:54:21 (GMT)
commit58b8b95cdb577694e48a5f673acb58b454dd3f8b (patch)
tree450af891bf2606fab70fe8a045bd745e05359644 /Lib
parent3864459196cc8d5f9477d6e635736cc2372f257e (diff)
downloadcpython-58b8b95cdb577694e48a5f673acb58b454dd3f8b.zip
cpython-58b8b95cdb577694e48a5f673acb58b454dd3f8b.tar.gz
cpython-58b8b95cdb577694e48a5f673acb58b454dd3f8b.tar.bz2
In Pdb, stop assigning values to __builtin__._ which interferes with the one commonly installed by gettext.
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/pdb.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 3f76032..9025be1 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -194,6 +194,12 @@ class Pdb(bdb.Bdb, cmd.Cmd):
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
@@ -202,13 +208,16 @@ class Pdb(bdb.Bdb, cmd.Cmd):
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(''):