[Python-checkins] r87025 - in python/branches/py3k: Doc/library/pdb.rst Lib/pdb.py Misc/NEWS
georg.brandl
python-checkins at python.org
Sat Dec 4 12:20:26 CET 2010
Author: georg.brandl
Date: Sat Dec 4 12:20:26 2010
New Revision: 87025
Log:
Add the "interact" pdb command from pdb++.
Modified:
python/branches/py3k/Doc/library/pdb.rst
python/branches/py3k/Lib/pdb.py
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Doc/library/pdb.rst
==============================================================================
--- python/branches/py3k/Doc/library/pdb.rst (original)
+++ python/branches/py3k/Doc/library/pdb.rst Sat Dec 4 12:20:26 2010
@@ -407,6 +407,14 @@
.. versionadded:: 3.2
+.. pdbcommand:: interact
+
+ Start an interative interpreter (using the :mod:`code` module) whose global
+ namespace contains all the (global and local) names found in the current
+ scope.
+
+ .. versionadded:: 3.2
+
.. _debugger-aliases:
.. pdbcommand:: alias [name [command]]
Modified: python/branches/py3k/Lib/pdb.py
==============================================================================
--- python/branches/py3k/Lib/pdb.py (original)
+++ python/branches/py3k/Lib/pdb.py Sat Dec 4 12:20:26 2010
@@ -67,15 +67,16 @@
# commands and is appended to __doc__ after the class has been defined.
import sys
-import linecache
import cmd
import bdb
import dis
import os
import re
+import code
import pprint
-import traceback
import inspect
+import traceback
+import linecache
class Restart(Exception):
@@ -1167,6 +1168,16 @@
# None of the above...
self.message(type(value))
+ def do_interact(self, arg):
+ """interact
+
+ Start an interative interpreter whose global namespace
+ contains all the (global and local) names found in the current scope.
+ """
+ ns = self.curframe.f_globals.copy()
+ ns.update(self.curframe_locals)
+ code.interact("*interactive*", local=ns)
+
def do_alias(self, arg):
"""alias [name [command [parameter parameter ...] ]]
Create an alias called 'name' that executes 'command'. The
@@ -1342,8 +1353,8 @@
'help', 'where', 'down', 'up', 'break', 'tbreak', 'clear', 'disable',
'enable', 'ignore', 'condition', 'commands', 'step', 'next', 'until',
'jump', 'return', 'retval', 'run', 'continue', 'list', 'longlist',
- 'args', 'print', 'pp', 'whatis', 'source', 'alias', 'unalias',
- 'debug', 'quit',
+ 'args', 'print', 'pp', 'whatis', 'source', 'interact', 'alias',
+ 'unalias', 'debug', 'quit',
]
for _command in _help_order:
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Sat Dec 4 12:20:26 2010
@@ -45,6 +45,8 @@
Library
-------
+- Add the "interact" pdb command.
+
- Issue #7905: Actually respect the keyencoding parameter to shelve.Shelf.
- Issue #1569291: Speed up array.repeat().
More information about the Python-checkins
mailing list