2010-10-29 02:24:24 -03:00
|
|
|
.. _debugger:
|
|
|
|
|
2007-09-12 15:04:37 -03:00
|
|
|
:mod:`pdb` --- The Python Debugger
|
|
|
|
==================================
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. module:: pdb
|
|
|
|
:synopsis: The Python debugger for interactive interpreters.
|
|
|
|
|
2014-09-30 17:02:06 -03:00
|
|
|
**Source code:** :source:`Lib/pdb.py`
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. index:: single: debugging
|
|
|
|
|
2016-06-11 16:02:54 -03:00
|
|
|
--------------
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
The module :mod:`pdb` defines an interactive source code debugger for Python
|
|
|
|
programs. It supports setting (conditional) breakpoints and single stepping at
|
|
|
|
the source line level, inspection of stack frames, source code listing, and
|
|
|
|
evaluation of arbitrary Python code in the context of any stack frame. It also
|
|
|
|
supports post-mortem debugging and can be called under program control.
|
|
|
|
|
|
|
|
.. index::
|
|
|
|
single: Pdb (class in pdb)
|
2023-05-04 05:17:12 -03:00
|
|
|
pair: module; bdb
|
|
|
|
pair: module; cmd
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
The debugger is extensible -- it is actually defined as the class :class:`Pdb`.
|
2007-08-15 11:28:22 -03:00
|
|
|
This is currently undocumented but easily understood by reading the source. The
|
2010-03-21 06:04:24 -03:00
|
|
|
extension interface uses the modules :mod:`bdb` and :mod:`cmd`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-02-03 23:49:29 -04:00
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
Module :mod:`faulthandler`
|
|
|
|
Used to dump Python tracebacks explicitly, on a fault, after a timeout,
|
|
|
|
or on a user signal.
|
|
|
|
|
|
|
|
Module :mod:`traceback`
|
|
|
|
Standard interface to extract, format and print stack traces of Python programs.
|
|
|
|
|
2023-04-12 03:18:34 -03:00
|
|
|
The typical usage to break into the debugger is to insert::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-04-12 03:18:34 -03:00
|
|
|
import pdb; pdb.set_trace()
|
|
|
|
|
|
|
|
Or::
|
|
|
|
|
|
|
|
breakpoint()
|
|
|
|
|
|
|
|
at the location you want to break into the debugger, and then run the program.
|
|
|
|
You can then step through the code following this statement, and continue
|
|
|
|
running without the debugger using the :pdbcmd:`continue` command.
|
|
|
|
|
2024-01-22 17:40:26 -04:00
|
|
|
.. versionchanged:: 3.7
|
2024-08-30 08:34:09 -03:00
|
|
|
The built-in :func:`breakpoint`, when called with defaults, can be used
|
2023-04-12 03:18:34 -03:00
|
|
|
instead of ``import pdb; pdb.set_trace()``.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
def double(x):
|
|
|
|
breakpoint()
|
|
|
|
return x * 2
|
|
|
|
val = 3
|
|
|
|
print(f"{val} * 2 is {double(val)}")
|
|
|
|
|
|
|
|
The debugger's prompt is ``(Pdb)``, which is the indicator that you are in debug mode::
|
|
|
|
|
2024-05-05 11:05:01 -03:00
|
|
|
> ...(2)double()
|
|
|
|
-> breakpoint()
|
2023-04-12 03:18:34 -03:00
|
|
|
(Pdb) p x
|
|
|
|
3
|
2007-08-15 11:28:22 -03:00
|
|
|
(Pdb) continue
|
2023-04-12 03:18:34 -03:00
|
|
|
3 * 2 is 6
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2012-03-10 17:36:48 -04:00
|
|
|
.. versionchanged:: 3.3
|
|
|
|
Tab-completion via the :mod:`readline` module is available for commands and
|
|
|
|
command arguments, e.g. the current global and local names are offered as
|
2013-10-10 18:23:26 -03:00
|
|
|
arguments of the ``p`` command.
|
2012-03-10 17:36:48 -04:00
|
|
|
|
2023-04-12 03:18:34 -03:00
|
|
|
|
|
|
|
You can also invoke :mod:`pdb` from the command line to debug other scripts. For
|
2007-08-15 11:28:22 -03:00
|
|
|
example::
|
|
|
|
|
2023-03-14 15:40:12 -03:00
|
|
|
python -m pdb myscript.py
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-04-12 03:18:34 -03:00
|
|
|
When invoked as a module, pdb will automatically enter post-mortem debugging if
|
2010-07-30 05:29:39 -03:00
|
|
|
the program being debugged exits abnormally. After post-mortem debugging (or
|
|
|
|
after normal exit of the program), pdb will restart the program. Automatic
|
2007-08-15 11:28:22 -03:00
|
|
|
restarting preserves pdb's state (such as breakpoints) and in most cases is more
|
|
|
|
useful than quitting the debugger upon program's exit.
|
|
|
|
|
2024-01-22 17:40:26 -04:00
|
|
|
.. versionchanged:: 3.2
|
|
|
|
Added the ``-c`` option to execute commands as if given
|
|
|
|
in a :file:`.pdbrc` file; see :ref:`debugger-commands`.
|
2010-07-30 05:29:39 -03:00
|
|
|
|
2024-01-22 17:40:26 -04:00
|
|
|
.. versionchanged:: 3.7
|
|
|
|
Added the ``-m`` option to execute modules similar to the way
|
2023-03-14 15:40:12 -03:00
|
|
|
``python -m`` does. As with a script, the debugger will pause execution just
|
2018-01-06 03:53:05 -04:00
|
|
|
before the first line of the module.
|
|
|
|
|
2023-04-12 03:18:34 -03:00
|
|
|
Typical usage to execute a statement under control of the debugger is::
|
2018-01-06 03:53:05 -04:00
|
|
|
|
2023-04-12 03:18:34 -03:00
|
|
|
>>> import pdb
|
|
|
|
>>> def f(x):
|
|
|
|
... print(1 / x)
|
|
|
|
>>> pdb.run("f(2)")
|
|
|
|
> <string>(1)<module>()
|
|
|
|
(Pdb) continue
|
|
|
|
0.5
|
|
|
|
>>>
|
2019-01-30 13:23:39 -04:00
|
|
|
|
2009-05-05 06:00:19 -03:00
|
|
|
The typical usage to inspect a crashed program is::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
>>> import pdb
|
2023-04-12 03:18:34 -03:00
|
|
|
>>> def f(x):
|
|
|
|
... print(1 / x)
|
|
|
|
...
|
|
|
|
>>> f(0)
|
2007-08-15 11:28:22 -03:00
|
|
|
Traceback (most recent call last):
|
2017-05-03 13:46:45 -03:00
|
|
|
File "<stdin>", line 1, in <module>
|
2023-04-12 03:18:34 -03:00
|
|
|
File "<stdin>", line 2, in f
|
|
|
|
ZeroDivisionError: division by zero
|
2007-08-15 11:28:22 -03:00
|
|
|
>>> pdb.pm()
|
2023-04-12 03:18:34 -03:00
|
|
|
> <stdin>(2)f()
|
|
|
|
(Pdb) p x
|
|
|
|
0
|
2009-01-03 17:18:54 -04:00
|
|
|
(Pdb)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2024-05-21 00:32:15 -03:00
|
|
|
.. versionchanged:: 3.13
|
|
|
|
The implementation of :pep:`667` means that name assignments made via ``pdb``
|
|
|
|
will immediately affect the active scope, even when running inside an
|
|
|
|
:term:`optimized scope`.
|
|
|
|
|
2009-05-05 06:00:19 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
The module defines the following functions; each enters the debugger in a
|
|
|
|
slightly different way:
|
|
|
|
|
2009-09-02 17:34:52 -03:00
|
|
|
.. function:: run(statement, globals=None, locals=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-30 06:14:20 -03:00
|
|
|
Execute the *statement* (given as a string or a code object) under debugger
|
|
|
|
control. The debugger prompt appears before any code is executed; you can
|
|
|
|
set breakpoints and type :pdbcmd:`continue`, or you can step through the
|
|
|
|
statement using :pdbcmd:`step` or :pdbcmd:`next` (all these commands are
|
|
|
|
explained below). The optional *globals* and *locals* arguments specify the
|
|
|
|
environment in which the code is executed; by default the dictionary of the
|
|
|
|
module :mod:`__main__` is used. (See the explanation of the built-in
|
|
|
|
:func:`exec` or :func:`eval` functions.)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-09-02 17:34:52 -03:00
|
|
|
.. function:: runeval(expression, globals=None, locals=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-30 06:14:20 -03:00
|
|
|
Evaluate the *expression* (given as a string or a code object) under debugger
|
|
|
|
control. When :func:`runeval` returns, it returns the value of the
|
2023-03-25 18:31:45 -03:00
|
|
|
*expression*. Otherwise this function is similar to :func:`run`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-09-02 17:34:52 -03:00
|
|
|
.. function:: runcall(function, *args, **kwds)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
Call the *function* (a function or method object, not a string) with the
|
|
|
|
given arguments. When :func:`runcall` returns, it returns whatever the
|
|
|
|
function call returned. The debugger prompt appears as soon as the function
|
|
|
|
is entered.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2024-09-24 16:52:15 -03:00
|
|
|
.. function:: set_trace(*, header=None, commands=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2017-09-22 13:29:42 -03:00
|
|
|
Enter the debugger at the calling stack frame. This is useful to hard-code
|
|
|
|
a breakpoint at a given point in a program, even if the code is not
|
|
|
|
otherwise being debugged (e.g. when an assertion fails). If given,
|
2017-11-04 09:17:56 -03:00
|
|
|
*header* is printed to the console just before debugging begins.
|
2024-09-24 16:52:15 -03:00
|
|
|
The *commands* argument, if given, is a list of commands to execute
|
|
|
|
when the debugger starts.
|
|
|
|
|
2017-09-22 13:29:42 -03:00
|
|
|
|
2017-11-04 09:17:56 -03:00
|
|
|
.. versionchanged:: 3.7
|
|
|
|
The keyword-only argument *header*.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2024-05-05 11:05:01 -03:00
|
|
|
.. versionchanged:: 3.13
|
|
|
|
:func:`set_trace` will enter the debugger immediately, rather than
|
|
|
|
on the next line of code to be executed.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2024-09-24 16:52:15 -03:00
|
|
|
.. versionadded:: 3.14
|
|
|
|
The *commands* argument.
|
|
|
|
|
2009-09-02 17:34:52 -03:00
|
|
|
.. function:: post_mortem(traceback=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-01-03 17:18:54 -04:00
|
|
|
Enter post-mortem debugging of the given *traceback* object. If no
|
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61239 | andrew.kuchling | 2008-03-05 01:44:41 +0100 (Wed, 05 Mar 2008) | 1 line
Add more items; add fragmentary notes
........
r61240 | amaury.forgeotdarc | 2008-03-05 02:50:33 +0100 (Wed, 05 Mar 2008) | 13 lines
Issue#2238: some syntax errors from *args or **kwargs expressions
would give bogus error messages, because of untested exceptions::
>>> f(**g(1=2))
XXX undetected error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable
instead of the expected SyntaxError: keyword can't be an expression
Will backport.
........
r61241 | neal.norwitz | 2008-03-05 06:10:48 +0100 (Wed, 05 Mar 2008) | 3 lines
Remove the files/dirs after closing the DB so the tests work on Windows.
Patch from Trent Nelson. Also simplified removing a file by using test_support.
........
r61242 | neal.norwitz | 2008-03-05 06:14:18 +0100 (Wed, 05 Mar 2008) | 3 lines
Get this test to pass even when there is no sound card in the system.
Patch from Trent Nelson. (I can't test this.)
........
r61243 | neal.norwitz | 2008-03-05 06:20:44 +0100 (Wed, 05 Mar 2008) | 3 lines
Catch OSError when trying to remove a file in case removal fails. This
should prevent a failure in tearDown masking any real test failure.
........
r61244 | neal.norwitz | 2008-03-05 06:38:06 +0100 (Wed, 05 Mar 2008) | 5 lines
Make the timeout longer to give slow machines a chance to pass the test
before timing out. This doesn't change the duration of the test under
normal circumstances. This is targetted at fixing the spurious failures
on the FreeBSD buildbot primarily.
........
r61245 | neal.norwitz | 2008-03-05 06:49:03 +0100 (Wed, 05 Mar 2008) | 1 line
Tabs -> spaces
........
r61246 | neal.norwitz | 2008-03-05 06:50:20 +0100 (Wed, 05 Mar 2008) | 1 line
Use -u urlfetch to run more tests
........
r61247 | neal.norwitz | 2008-03-05 06:51:20 +0100 (Wed, 05 Mar 2008) | 1 line
test_smtplib sometimes reports leaks too, suppress it
........
r61248 | jeffrey.yasskin | 2008-03-05 07:19:56 +0100 (Wed, 05 Mar 2008) | 5 lines
Fix test_socketserver on Windows after r61099 added several signal.alarm()
calls (which don't exist on non-Unix platforms).
Thanks to Trent Nelson for the report and patch.
........
r61249 | georg.brandl | 2008-03-05 08:10:35 +0100 (Wed, 05 Mar 2008) | 2 lines
Fix some rst.
........
r61252 | thomas.heller | 2008-03-05 15:53:39 +0100 (Wed, 05 Mar 2008) | 2 lines
News entry for yesterdays commit.
........
r61253 | thomas.heller | 2008-03-05 16:34:29 +0100 (Wed, 05 Mar 2008) | 3 lines
Issue 1872: Changed the struct module typecode from 't' to '?', for
compatibility with PEP3118.
........
r61254 | skip.montanaro | 2008-03-05 17:41:09 +0100 (Wed, 05 Mar 2008) | 4 lines
Elaborate on the role of the altinstall target when installing multiple
versions.
........
r61255 | georg.brandl | 2008-03-05 20:31:44 +0100 (Wed, 05 Mar 2008) | 2 lines
#2239: PYTHONPATH delimiter is os.pathsep.
........
r61256 | raymond.hettinger | 2008-03-05 21:59:58 +0100 (Wed, 05 Mar 2008) | 1 line
C implementation of itertools.permutations().
........
r61257 | raymond.hettinger | 2008-03-05 22:04:32 +0100 (Wed, 05 Mar 2008) | 1 line
Small code cleanup.
........
r61260 | martin.v.loewis | 2008-03-05 23:24:31 +0100 (Wed, 05 Mar 2008) | 2 lines
cd PCbuild only after deleting all pyc files.
........
r61261 | raymond.hettinger | 2008-03-06 02:15:52 +0100 (Thu, 06 Mar 2008) | 1 line
Add examples.
........
r61262 | andrew.kuchling | 2008-03-06 02:36:27 +0100 (Thu, 06 Mar 2008) | 1 line
Add two items
........
r61263 | georg.brandl | 2008-03-06 07:47:18 +0100 (Thu, 06 Mar 2008) | 2 lines
#1725737: ignore other VC directories other than CVS and SVN's too.
........
r61264 | martin.v.loewis | 2008-03-06 07:55:22 +0100 (Thu, 06 Mar 2008) | 4 lines
Patch #2232: os.tmpfile might fail on Windows if the user has no
permission to create files in the root directory.
Will backport to 2.5.
........
r61269 | georg.brandl | 2008-03-06 08:19:15 +0100 (Thu, 06 Mar 2008) | 2 lines
Expand on re.split behavior with captured expressions.
........
r61270 | georg.brandl | 2008-03-06 08:22:09 +0100 (Thu, 06 Mar 2008) | 2 lines
Little clarification of assignments.
........
r61271 | georg.brandl | 2008-03-06 08:31:34 +0100 (Thu, 06 Mar 2008) | 2 lines
Add isinstance/issubclass to tutorial.
........
r61272 | georg.brandl | 2008-03-06 08:34:52 +0100 (Thu, 06 Mar 2008) | 2 lines
Add missing NEWS entry for r61263.
........
r61273 | georg.brandl | 2008-03-06 08:41:16 +0100 (Thu, 06 Mar 2008) | 2 lines
#2225: return nonzero status code from py_compile if not all files could be compiled.
........
r61274 | georg.brandl | 2008-03-06 08:43:02 +0100 (Thu, 06 Mar 2008) | 2 lines
#2220: handle matching failure more gracefully.
........
r61275 | georg.brandl | 2008-03-06 08:45:52 +0100 (Thu, 06 Mar 2008) | 2 lines
Bug #2220: handle rlcompleter attribute match failure more gracefully.
........
r61278 | martin.v.loewis | 2008-03-06 14:49:47 +0100 (Thu, 06 Mar 2008) | 1 line
Rely on x64 platform configuration when building _bsddb on AMD64.
........
r61279 | martin.v.loewis | 2008-03-06 14:50:28 +0100 (Thu, 06 Mar 2008) | 1 line
Update db-4.4.20 build procedure.
........
r61285 | raymond.hettinger | 2008-03-06 21:52:01 +0100 (Thu, 06 Mar 2008) | 1 line
More tests.
........
r61286 | raymond.hettinger | 2008-03-06 23:51:36 +0100 (Thu, 06 Mar 2008) | 1 line
Issue 2246: itertools grouper object did not participate in GC (should be backported).
........
r61288 | raymond.hettinger | 2008-03-07 02:33:20 +0100 (Fri, 07 Mar 2008) | 1 line
Tweak recipes and tests
........
r61289 | jeffrey.yasskin | 2008-03-07 07:22:15 +0100 (Fri, 07 Mar 2008) | 5 lines
Progress on issue #1193577 by adding a polling .shutdown() method to
SocketServers. The core of the patch was written by Pedro Werneck, but any bugs
are mine. I've also rearranged the code for timeouts in order to avoid
interfering with the shutdown poll.
........
r61290 | nick.coghlan | 2008-03-07 15:13:28 +0100 (Fri, 07 Mar 2008) | 1 line
Speed up with statements by storing the __exit__ method on the stack instead of in a temp variable (bumps the magic number for pyc files)
........
r61298 | andrew.kuchling | 2008-03-07 22:09:23 +0100 (Fri, 07 Mar 2008) | 1 line
Grammar fix
........
r61303 | georg.brandl | 2008-03-08 10:54:06 +0100 (Sat, 08 Mar 2008) | 2 lines
#2253: fix continue vs. finally docs.
........
r61304 | marc-andre.lemburg | 2008-03-08 11:01:43 +0100 (Sat, 08 Mar 2008) | 3 lines
Add new name for Mandrake: Mandriva.
........
r61305 | georg.brandl | 2008-03-08 11:05:24 +0100 (Sat, 08 Mar 2008) | 2 lines
#1533486: fix types in refcount intro.
........
r61312 | facundo.batista | 2008-03-08 17:50:27 +0100 (Sat, 08 Mar 2008) | 5 lines
Issue 1106316. post_mortem()'s parameter, traceback, is now
optional: it defaults to the traceback of the exception that is currently
being handled.
........
r61313 | jeffrey.yasskin | 2008-03-08 19:26:54 +0100 (Sat, 08 Mar 2008) | 2 lines
Add tests for with and finally performance to pybench.
........
r61314 | jeffrey.yasskin | 2008-03-08 21:08:21 +0100 (Sat, 08 Mar 2008) | 2 lines
Fix pybench for pythons < 2.6, tested back to 2.3.
........
r61317 | jeffrey.yasskin | 2008-03-08 22:35:15 +0100 (Sat, 08 Mar 2008) | 3 lines
Well that was dumb. platform.python_implementation returns a function, not a
string.
........
r61329 | georg.brandl | 2008-03-09 16:11:39 +0100 (Sun, 09 Mar 2008) | 2 lines
#2249: document assertTrue and assertFalse.
........
r61332 | neal.norwitz | 2008-03-09 20:03:42 +0100 (Sun, 09 Mar 2008) | 4 lines
Introduce a lock to fix a race condition which caused an exception in the test.
Some buildbots were consistently failing (e.g., amd64).
Also remove a couple of semi-colons.
........
r61344 | raymond.hettinger | 2008-03-11 01:19:07 +0100 (Tue, 11 Mar 2008) | 1 line
Add recipe to docs.
........
r61350 | guido.van.rossum | 2008-03-11 22:18:06 +0100 (Tue, 11 Mar 2008) | 3 lines
Fix the overflows in expandtabs(). "This time for sure!"
(Exploit at request.)
........
r61351 | raymond.hettinger | 2008-03-11 22:37:46 +0100 (Tue, 11 Mar 2008) | 1 line
Improve docs for itemgetter(). Show that it works with slices.
........
r61363 | georg.brandl | 2008-03-13 08:15:56 +0100 (Thu, 13 Mar 2008) | 2 lines
#2265: fix example.
........
r61364 | georg.brandl | 2008-03-13 08:17:14 +0100 (Thu, 13 Mar 2008) | 2 lines
#2270: fix typo.
........
r61365 | georg.brandl | 2008-03-13 08:21:41 +0100 (Thu, 13 Mar 2008) | 2 lines
#1720705: add docs about import/threading interaction, wording by Nick.
........
r61366 | andrew.kuchling | 2008-03-13 12:07:35 +0100 (Thu, 13 Mar 2008) | 1 line
Add class decorators
........
r61367 | raymond.hettinger | 2008-03-13 17:43:17 +0100 (Thu, 13 Mar 2008) | 1 line
Add 2-to-3 support for the itertools moved to builtins or renamed.
........
r61368 | raymond.hettinger | 2008-03-13 17:43:59 +0100 (Thu, 13 Mar 2008) | 1 line
Consistent tense.
........
r61369 | raymond.hettinger | 2008-03-13 20:03:51 +0100 (Thu, 13 Mar 2008) | 1 line
Issue 2274: Add heapq.heappushpop().
........
r61370 | raymond.hettinger | 2008-03-13 20:33:34 +0100 (Thu, 13 Mar 2008) | 1 line
Simplify the nlargest() code using heappushpop().
........
r61371 | brett.cannon | 2008-03-13 21:27:00 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_thread over to unittest. Commits GHOP 237.
Thanks Benjamin Peterson for the patch.
........
r61372 | brett.cannon | 2008-03-13 21:33:10 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_tokenize to doctest.
Done as GHOP 238 by Josip Dzolonga.
........
r61373 | brett.cannon | 2008-03-13 21:47:41 +0100 (Thu, 13 Mar 2008) | 4 lines
Convert test_contains, test_crypt, and test_select to unittest.
Patch from GHOP 294 by David Marek.
........
r61374 | brett.cannon | 2008-03-13 22:02:16 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_gdbm to use unittest.
Closes issue #1960. Thanks Giampaolo Rodola.
........
r61375 | brett.cannon | 2008-03-13 22:09:28 +0100 (Thu, 13 Mar 2008) | 4 lines
Convert test_fcntl to unittest.
Closes issue #2055. Thanks Giampaolo Rodola.
........
r61376 | raymond.hettinger | 2008-03-14 06:03:44 +0100 (Fri, 14 Mar 2008) | 1 line
Leave heapreplace() unchanged.
........
r61378 | martin.v.loewis | 2008-03-14 14:56:09 +0100 (Fri, 14 Mar 2008) | 2 lines
Patch #2284: add -x64 option to rt.bat.
........
r61379 | martin.v.loewis | 2008-03-14 14:57:59 +0100 (Fri, 14 Mar 2008) | 2 lines
Use -x64 flag.
........
r61382 | brett.cannon | 2008-03-14 15:03:10 +0100 (Fri, 14 Mar 2008) | 2 lines
Remove a bad test.
........
r61383 | mark.dickinson | 2008-03-14 15:23:37 +0100 (Fri, 14 Mar 2008) | 9 lines
Issue 705836: Fix struct.pack(">f", 1e40) to behave consistently
across platforms: it should now raise OverflowError on all
platforms. (Previously it raised OverflowError only on
non IEEE 754 platforms.)
Also fix the (already existing) test for this behaviour
so that it actually raises TestFailed instead of just
referencing it.
........
r61387 | thomas.heller | 2008-03-14 22:06:21 +0100 (Fri, 14 Mar 2008) | 1 line
Remove unneeded initializer.
........
r61388 | martin.v.loewis | 2008-03-14 22:19:28 +0100 (Fri, 14 Mar 2008) | 2 lines
Run debug version, cd to PCbuild.
........
r61392 | georg.brandl | 2008-03-15 00:10:34 +0100 (Sat, 15 Mar 2008) | 2 lines
Remove obsolete paragraph. #2288.
........
r61395 | georg.brandl | 2008-03-15 01:20:19 +0100 (Sat, 15 Mar 2008) | 2 lines
Fix lots of broken links in the docs, found by Sphinx' external link checker.
........
r61396 | skip.montanaro | 2008-03-15 03:32:49 +0100 (Sat, 15 Mar 2008) | 1 line
note that fork and forkpty raise OSError on failure
........
r61402 | skip.montanaro | 2008-03-15 17:04:45 +0100 (Sat, 15 Mar 2008) | 1 line
add %f format to datetime - issue 1158
........
r61403 | skip.montanaro | 2008-03-15 17:07:11 +0100 (Sat, 15 Mar 2008) | 2 lines
.
........
2008-03-15 21:07:10 -03:00
|
|
|
*traceback* is given, it uses the one of the exception that is currently
|
|
|
|
being handled (an exception must be being handled if the default is to be
|
|
|
|
used).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: pm()
|
|
|
|
|
2023-08-28 15:31:03 -03:00
|
|
|
Enter post-mortem debugging of the exception found in
|
|
|
|
:data:`sys.last_exc`.
|
2009-05-05 06:00:19 -03:00
|
|
|
|
|
|
|
|
2011-01-14 04:25:03 -04:00
|
|
|
The ``run*`` functions and :func:`set_trace` are aliases for instantiating the
|
2009-05-05 06:00:19 -03:00
|
|
|
:class:`Pdb` class and calling the method of the same name. If you want to
|
|
|
|
access further features, you have to do this yourself:
|
|
|
|
|
2010-12-04 12:00:47 -04:00
|
|
|
.. class:: Pdb(completekey='tab', stdin=None, stdout=None, skip=None, \
|
2024-09-25 15:18:01 -03:00
|
|
|
nosigint=False, readrc=True, mode=None)
|
2009-05-05 06:00:19 -03:00
|
|
|
|
|
|
|
:class:`Pdb` is the debugger class.
|
|
|
|
|
|
|
|
The *completekey*, *stdin* and *stdout* arguments are passed to the
|
|
|
|
underlying :class:`cmd.Cmd` class; see the description there.
|
|
|
|
|
|
|
|
The *skip* argument, if given, must be an iterable of glob-style module name
|
|
|
|
patterns. The debugger will not step into frames that originate in a module
|
|
|
|
that matches one of these patterns. [1]_
|
|
|
|
|
2010-12-04 12:00:47 -04:00
|
|
|
By default, Pdb sets a handler for the SIGINT signal (which is sent when the
|
2023-03-25 18:31:45 -03:00
|
|
|
user presses :kbd:`Ctrl-C` on the console) when you give a :pdbcmd:`continue` command.
|
2015-09-12 11:45:25 -03:00
|
|
|
This allows you to break into the debugger again by pressing :kbd:`Ctrl-C`. If you
|
2016-08-24 18:52:57 -03:00
|
|
|
want Pdb not to touch the SIGINT handler, set *nosigint* to true.
|
2010-12-04 12:00:47 -04:00
|
|
|
|
2016-09-10 03:28:03 -03:00
|
|
|
The *readrc* argument defaults to true and controls whether Pdb will load
|
2016-09-10 02:21:17 -03:00
|
|
|
.pdbrc files from the filesystem.
|
|
|
|
|
2024-09-25 15:18:01 -03:00
|
|
|
The *mode* argument specifies how the debugger was invoked.
|
|
|
|
It impacts the workings of some debugger commands.
|
|
|
|
Valid values are ``'inline'`` (used by the breakpoint() builtin),
|
|
|
|
``'cli'`` (used by the command line invocation)
|
|
|
|
or ``None`` (for backwards compatible behaviour, as before the *mode*
|
|
|
|
argument was added).
|
|
|
|
|
2009-05-05 06:00:19 -03:00
|
|
|
Example call to enable tracing with *skip*::
|
|
|
|
|
|
|
|
import pdb; pdb.Pdb(skip=['django.*']).set_trace()
|
|
|
|
|
2019-06-27 14:47:59 -03:00
|
|
|
.. audit-event:: pdb.Pdb "" pdb.Pdb
|
2019-06-24 12:42:54 -03:00
|
|
|
|
2024-01-22 17:40:26 -04:00
|
|
|
.. versionchanged:: 3.1
|
|
|
|
Added the *skip* parameter.
|
2009-05-05 06:00:19 -03:00
|
|
|
|
2024-01-22 17:40:26 -04:00
|
|
|
.. versionchanged:: 3.2
|
|
|
|
Added the *nosigint* parameter.
|
|
|
|
Previously, a SIGINT handler was never set by Pdb.
|
2010-12-04 12:00:47 -04:00
|
|
|
|
2016-09-10 03:28:03 -03:00
|
|
|
.. versionchanged:: 3.6
|
2016-09-10 02:21:17 -03:00
|
|
|
The *readrc* argument.
|
|
|
|
|
2024-09-25 15:18:01 -03:00
|
|
|
.. versionadded:: 3.14
|
|
|
|
Added the *mode* argument.
|
|
|
|
|
2009-09-02 17:34:52 -03:00
|
|
|
.. method:: run(statement, globals=None, locals=None)
|
|
|
|
runeval(expression, globals=None, locals=None)
|
|
|
|
runcall(function, *args, **kwds)
|
2009-05-05 06:00:19 -03:00
|
|
|
set_trace()
|
|
|
|
|
|
|
|
See the documentation for the functions explained above.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. _debugger-commands:
|
|
|
|
|
|
|
|
Debugger Commands
|
2010-10-27 00:06:43 -03:00
|
|
|
-----------------
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
The commands recognized by the debugger are listed below. Most commands can be
|
|
|
|
abbreviated to one or two letters as indicated; e.g. ``h(elp)`` means that
|
|
|
|
either ``h`` or ``help`` can be used to enter the help command (but not ``he``
|
|
|
|
or ``hel``, nor ``H`` or ``Help`` or ``HELP``). Arguments to commands must be
|
|
|
|
separated by whitespace (spaces or tabs). Optional arguments are enclosed in
|
|
|
|
square brackets (``[]``) in the command syntax; the square brackets must not be
|
|
|
|
typed. Alternatives in the command syntax are separated by a vertical bar
|
|
|
|
(``|``).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Entering a blank line repeats the last command entered. Exception: if the last
|
2010-07-18 07:11:03 -03:00
|
|
|
command was a :pdbcmd:`list` command, the next 11 lines are listed.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Commands that the debugger doesn't recognize are assumed to be Python statements
|
|
|
|
and are executed in the context of the program being debugged. Python
|
|
|
|
statements can also be prefixed with an exclamation point (``!``). This is a
|
|
|
|
powerful way to inspect the program being debugged; it is even possible to
|
|
|
|
change a variable or call a function. When an exception occurs in such a
|
|
|
|
statement, the exception name is printed but the debugger's state is not
|
|
|
|
changed.
|
|
|
|
|
2023-09-04 18:44:40 -03:00
|
|
|
.. versionchanged:: 3.13
|
|
|
|
Expressions/Statements whose prefix is a pdb command are now correctly
|
|
|
|
identified and executed.
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
The debugger supports :ref:`aliases <debugger-aliases>`. Aliases can have
|
|
|
|
parameters which allows one a certain level of adaptability to the context under
|
|
|
|
examination.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
Multiple commands may be entered on a single line, separated by ``;;``. (A
|
|
|
|
single ``;`` is not used as it is the separator for multiple commands in a line
|
2010-07-18 07:11:03 -03:00
|
|
|
that is passed to the Python parser.) No intelligence is applied to separating
|
2007-08-15 11:28:22 -03:00
|
|
|
the commands; the input is split at the first ``;;`` pair, even if it is in the
|
2022-05-08 20:20:42 -03:00
|
|
|
middle of a quoted string. A workaround for strings with double semicolons
|
|
|
|
is to use implicit string concatenation ``';'';'`` or ``";"";"``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-05-03 11:04:50 -03:00
|
|
|
To set a temporary global variable, use a *convenience variable*. A *convenience
|
|
|
|
variable* is a variable whose name starts with ``$``. For example, ``$foo = 1``
|
|
|
|
sets a global variable ``$foo`` which you can use in the debugger session. The
|
|
|
|
*convenience variables* are cleared when the program resumes execution so it's
|
|
|
|
less likely to interfere with your program compared to using normal variables
|
|
|
|
like ``foo = 1``.
|
|
|
|
|
|
|
|
There are three preset *convenience variables*:
|
|
|
|
|
|
|
|
* ``$_frame``: the current frame you are debugging
|
|
|
|
* ``$_retval``: the return value if the frame is returning
|
|
|
|
* ``$_exception``: the exception if the frame is raising an exception
|
|
|
|
|
|
|
|
.. versionadded:: 3.12
|
|
|
|
|
2024-05-27 14:54:23 -03:00
|
|
|
Added the *convenience variable* feature.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. index::
|
|
|
|
pair: .pdbrc; file
|
|
|
|
triple: debugger; configuration; file
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
If a file :file:`.pdbrc` exists in the user's home directory or in the current
|
2021-07-08 04:16:08 -03:00
|
|
|
directory, it is read with ``'utf-8'`` encoding and executed as if it had been
|
2024-03-15 06:36:04 -03:00
|
|
|
typed at the debugger prompt, with the exception that empty lines and lines
|
|
|
|
starting with ``#`` are ignored. This is particularly useful for aliases. If both
|
2021-07-08 04:16:08 -03:00
|
|
|
files exist, the one in the home directory is read first and aliases defined there
|
|
|
|
can be overridden by the local file.
|
|
|
|
|
2010-07-30 05:29:39 -03:00
|
|
|
.. versionchanged:: 3.2
|
|
|
|
:file:`.pdbrc` can now contain commands that continue debugging, such as
|
|
|
|
:pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no
|
|
|
|
effect.
|
|
|
|
|
2024-03-07 04:05:03 -04:00
|
|
|
.. versionchanged:: 3.11
|
|
|
|
:file:`.pdbrc` is now read with ``'utf-8'`` encoding. Previously, it was read
|
|
|
|
with the system locale encoding.
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
|
|
|
|
.. pdbcommand:: h(elp) [command]
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
Without argument, print the list of available commands. With a *command* as
|
|
|
|
argument, print help about that command. ``help pdb`` displays the full
|
2010-07-19 05:02:46 -03:00
|
|
|
documentation (the docstring of the :mod:`pdb` module). Since the *command*
|
|
|
|
argument must be an identifier, ``help exec`` must be entered to get help on
|
|
|
|
the ``!`` command.
|
2010-07-18 07:11:03 -03:00
|
|
|
|
2024-06-14 15:25:23 -03:00
|
|
|
.. pdbcommand:: w(here) [count]
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2024-06-14 15:25:23 -03:00
|
|
|
Print a stack trace, with the most recent frame at the bottom. if *count*
|
|
|
|
is 0, print the current frame entry. If *count* is negative, print the least
|
|
|
|
recent - *count* frames. If *count* is positive, print the most recent
|
|
|
|
*count* frames. An arrow (``>``)
|
2007-08-15 11:28:22 -03:00
|
|
|
indicates the current frame, which determines the context of most commands.
|
|
|
|
|
2024-06-14 15:25:23 -03:00
|
|
|
.. versionchanged:: 3.14
|
|
|
|
*count* argument is added.
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: d(own) [count]
|
|
|
|
|
2010-06-27 07:37:48 -03:00
|
|
|
Move the current frame *count* (default one) levels down in the stack trace
|
|
|
|
(to a newer frame).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: u(p) [count]
|
|
|
|
|
|
|
|
Move the current frame *count* (default one) levels up in the stack trace (to
|
|
|
|
an older frame).
|
|
|
|
|
|
|
|
.. pdbcommand:: b(reak) [([filename:]lineno | function) [, condition]]
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2024-04-30 15:18:01 -03:00
|
|
|
With a *lineno* argument, set a break at line *lineno* in the current file.
|
|
|
|
The line number may be prefixed with a *filename* and a colon,
|
|
|
|
to specify a breakpoint in another file (possibly one that hasn't been loaded
|
2024-06-06 18:35:24 -03:00
|
|
|
yet). The file is searched on :data:`sys.path`. Acceptable forms of *filename*
|
2024-04-30 15:18:01 -03:00
|
|
|
are ``/abspath/to/file.py``, ``relpath/file.py``, ``module`` and
|
|
|
|
``package.module``.
|
|
|
|
|
|
|
|
With a *function* argument, set a break at the first executable statement within
|
|
|
|
that function. *function* can be any expression that evaluates to a function
|
|
|
|
in the current namespace.
|
2010-07-18 07:11:03 -03:00
|
|
|
|
|
|
|
If a second argument is present, it is an expression which must evaluate to
|
|
|
|
true before the breakpoint is honored.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
Without argument, list all breaks, including for each breakpoint, the number
|
|
|
|
of times that breakpoint has been hit, the current ignore count, and the
|
|
|
|
associated condition if any.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2024-04-30 15:18:01 -03:00
|
|
|
Each breakpoint is assigned a number to which all the other
|
|
|
|
breakpoint commands refer.
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: tbreak [([filename:]lineno | function) [, condition]]
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
Temporary breakpoint, which is removed automatically when it is first hit.
|
|
|
|
The arguments are the same as for :pdbcmd:`break`.
|
|
|
|
|
2019-11-11 16:47:48 -04:00
|
|
|
.. pdbcommand:: cl(ear) [filename:lineno | bpnumber ...]
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-11-29 07:54:17 -04:00
|
|
|
With a *filename:lineno* argument, clear all the breakpoints at this line.
|
2007-08-15 11:28:22 -03:00
|
|
|
With a space separated list of breakpoint numbers, clear those breakpoints.
|
|
|
|
Without argument, clear all breaks (but first ask confirmation).
|
|
|
|
|
2023-04-11 19:40:30 -03:00
|
|
|
.. pdbcommand:: disable bpnumber [bpnumber ...]
|
2010-07-18 07:11:03 -03:00
|
|
|
|
|
|
|
Disable the breakpoints given as a space separated list of breakpoint
|
|
|
|
numbers. Disabling a breakpoint means it cannot cause the program to stop
|
|
|
|
execution, but unlike clearing a breakpoint, it remains in the list of
|
|
|
|
breakpoints and can be (re-)enabled.
|
|
|
|
|
2023-04-11 19:40:30 -03:00
|
|
|
.. pdbcommand:: enable bpnumber [bpnumber ...]
|
2010-07-18 07:11:03 -03:00
|
|
|
|
|
|
|
Enable the breakpoints specified.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: ignore bpnumber [count]
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
Set the ignore count for the given breakpoint number. If *count* is omitted,
|
2010-07-18 07:11:03 -03:00
|
|
|
the ignore count is set to 0. A breakpoint becomes active when the ignore
|
2023-03-25 18:31:45 -03:00
|
|
|
count is zero. When non-zero, the *count* is decremented each time the
|
2010-07-18 07:11:03 -03:00
|
|
|
breakpoint is reached and the breakpoint is not disabled and any associated
|
|
|
|
condition evaluates to true.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: condition bpnumber [condition]
|
|
|
|
|
|
|
|
Set a new *condition* for the breakpoint, an expression which must evaluate
|
|
|
|
to true before the breakpoint is honored. If *condition* is absent, any
|
|
|
|
existing condition is removed; i.e., the breakpoint is made unconditional.
|
|
|
|
|
|
|
|
.. pdbcommand:: commands [bpnumber]
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Specify a list of commands for breakpoint number *bpnumber*. The commands
|
2010-07-18 07:11:03 -03:00
|
|
|
themselves appear on the following lines. Type a line containing just
|
|
|
|
``end`` to terminate the commands. An example::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
(Pdb) commands 1
|
2013-10-10 18:23:26 -03:00
|
|
|
(com) p some_variable
|
2007-08-15 11:28:22 -03:00
|
|
|
(com) end
|
|
|
|
(Pdb)
|
|
|
|
|
2018-01-30 05:34:33 -04:00
|
|
|
To remove all commands from a breakpoint, type ``commands`` and follow it
|
2010-07-18 07:11:03 -03:00
|
|
|
immediately with ``end``; that is, give no commands.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2018-01-30 05:34:33 -04:00
|
|
|
With no *bpnumber* argument, ``commands`` refers to the last breakpoint set.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
You can use breakpoint commands to start your program up again. Simply use
|
2018-01-30 05:34:33 -04:00
|
|
|
the :pdbcmd:`continue` command, or :pdbcmd:`step`,
|
|
|
|
or any other command that resumes execution.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2018-01-30 05:34:33 -04:00
|
|
|
Specifying any command resuming execution
|
|
|
|
(currently :pdbcmd:`continue`, :pdbcmd:`step`, :pdbcmd:`next`,
|
2024-09-29 20:46:16 -03:00
|
|
|
:pdbcmd:`return`, :pdbcmd:`until`, :pdbcmd:`jump`, :pdbcmd:`quit` and their abbreviations)
|
2018-07-06 06:15:13 -03:00
|
|
|
terminates the command list (as if
|
2007-08-15 11:28:22 -03:00
|
|
|
that command was immediately followed by end). This is because any time you
|
#1370: Finish the merge r58749, log below, by resolving all conflicts in Doc/.
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 17:32:30 -03:00
|
|
|
resume execution (even with a simple next or step), you may encounter another
|
2016-11-20 20:15:20 -04:00
|
|
|
breakpoint—which could have its own command list, leading to ambiguities about
|
2007-08-15 11:28:22 -03:00
|
|
|
which list to execute.
|
|
|
|
|
2024-09-29 20:46:16 -03:00
|
|
|
If the list of commands contains the ``silent`` command, or a command that
|
|
|
|
resumes execution, then the breakpoint message containing information about
|
|
|
|
the frame is not displayed.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.14
|
|
|
|
Frame information will not be displayed if a command that resumes execution
|
|
|
|
is present in the command list.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: s(tep)
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
Execute the current line, stop at the first possible occasion (either in a
|
|
|
|
function that is called or on the next line in the current function).
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: n(ext)
|
|
|
|
|
|
|
|
Continue execution until the next line in the current function is reached or
|
|
|
|
it returns. (The difference between :pdbcmd:`next` and :pdbcmd:`step` is
|
|
|
|
that :pdbcmd:`step` stops inside a called function, while :pdbcmd:`next`
|
|
|
|
executes called functions at (nearly) full speed, only stopping at the next
|
|
|
|
line in the current function.)
|
|
|
|
|
2010-07-30 05:43:32 -03:00
|
|
|
.. pdbcommand:: unt(il) [lineno]
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-30 05:43:32 -03:00
|
|
|
Without argument, continue execution until the line with a number greater
|
|
|
|
than the current one is reached.
|
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
With *lineno*, continue execution until a line with a number greater or
|
|
|
|
equal to *lineno* is reached. In both cases, also stop when the current frame
|
2010-07-30 05:43:32 -03:00
|
|
|
returns.
|
Merged revisions 62998-63003,63005-63006,63009-63012,63014-63017,63019-63020,63022-63024,63026-63029,63031-63041,63043-63045,63047-63054,63056-63062 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62998 | andrew.kuchling | 2008-05-10 15:51:55 -0400 (Sat, 10 May 2008) | 7 lines
#1858 from Tarek Ziade:
Allow multiple repositories in .pypirc; see http://wiki.python.org/moin/EnhancedPyPI
for discussion.
The patch is slightly revised from Tarek's last patch: I've simplified
the PyPIRCCommand.finalize_options() method to not look at sys.argv.
Tests still pass.
........
r63000 | alexandre.vassalotti | 2008-05-10 15:59:16 -0400 (Sat, 10 May 2008) | 5 lines
Cleaned up io._BytesIO.write().
I am amazed that the old code, for inserting null-bytes, actually
worked. Who wrote that thing? Oh, it is me... doh.
........
r63002 | brett.cannon | 2008-05-10 16:52:01 -0400 (Sat, 10 May 2008) | 2 lines
Revert r62998 as it broke the build (seems distutils.config is missing).
........
r63014 | andrew.kuchling | 2008-05-10 18:12:38 -0400 (Sat, 10 May 2008) | 1 line
#1858: add distutils.config module
........
r63027 | brett.cannon | 2008-05-10 21:09:32 -0400 (Sat, 10 May 2008) | 2 lines
Flesh out the 3.0 deprecation to suggest using the ctypes module.
........
r63028 | skip.montanaro | 2008-05-10 22:59:30 -0400 (Sat, 10 May 2008) | 4 lines
Copied two versions of the example from the interactive session. Delete
one.
........
r63037 | georg.brandl | 2008-05-11 03:02:17 -0400 (Sun, 11 May 2008) | 2 lines
reload() takes the module itself.
........
r63038 | alexandre.vassalotti | 2008-05-11 03:06:04 -0400 (Sun, 11 May 2008) | 4 lines
Added test framework for handling module renames.
Factored the import guard in test_py3kwarn.TestStdlibRemovals into
a context manager, namely test_support.CleanImport.
........
r63039 | georg.brandl | 2008-05-11 03:06:05 -0400 (Sun, 11 May 2008) | 2 lines
#2742: ``''`` is not converted to NULL in getaddrinfo.
........
r63040 | alexandre.vassalotti | 2008-05-11 03:08:12 -0400 (Sun, 11 May 2008) | 2 lines
Fixed typo in a comment of test_support.CleanImport.
........
r63041 | alexandre.vassalotti | 2008-05-11 03:10:25 -0400 (Sun, 11 May 2008) | 2 lines
Removed a dead line of code.
........
r63043 | georg.brandl | 2008-05-11 04:47:53 -0400 (Sun, 11 May 2008) | 2 lines
#2812: document property.getter/setter/deleter.
........
r63049 | georg.brandl | 2008-05-11 05:06:30 -0400 (Sun, 11 May 2008) | 2 lines
#1153769: document PEP 237 changes to string formatting.
........
r63050 | georg.brandl | 2008-05-11 05:11:40 -0400 (Sun, 11 May 2008) | 2 lines
#2809: elaborate str.split docstring a bit.
........
r63051 | georg.brandl | 2008-05-11 06:13:59 -0400 (Sun, 11 May 2008) | 2 lines
Fix typo.
........
r63052 | georg.brandl | 2008-05-11 06:33:27 -0400 (Sun, 11 May 2008) | 2 lines
#2709: clarification.
........
r63053 | georg.brandl | 2008-05-11 06:42:28 -0400 (Sun, 11 May 2008) | 2 lines
#2659: add ``break_on_hyphens`` to TextWrapper.
........
r63057 | georg.brandl | 2008-05-11 06:59:39 -0400 (Sun, 11 May 2008) | 2 lines
#2741: clarification of value range for address_family.
........
r63058 | georg.brandl | 2008-05-11 07:09:35 -0400 (Sun, 11 May 2008) | 2 lines
#2452: timeout is used for all blocking operations.
........
r63059 | andrew.kuchling | 2008-05-11 09:33:56 -0400 (Sun, 11 May 2008) | 2 lines
#1792: Improve performance of marshal.dumps() on large objects by increasing
the size of the buffer more quickly.
........
r63060 | andrew.kuchling | 2008-05-11 10:00:00 -0400 (Sun, 11 May 2008) | 1 line
#1858: re-apply patch for this, adding the missing files
........
r63061 | benjamin.peterson | 2008-05-11 10:13:25 -0400 (Sun, 11 May 2008) | 2 lines
Add the "until" command to pdb
........
r63062 | georg.brandl | 2008-05-11 10:17:13 -0400 (Sun, 11 May 2008) | 2 lines
Add some sentence endings.
........
2008-05-15 21:03:33 -03:00
|
|
|
|
2010-07-30 05:45:26 -03:00
|
|
|
.. versionchanged:: 3.2
|
|
|
|
Allow giving an explicit line number.
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: r(eturn)
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
Continue execution until the current function returns.
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: c(ont(inue))
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
Continue execution, only stop when a breakpoint is encountered.
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: j(ump) lineno
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
Set the next line that will be executed. Only available in the bottom-most
|
2010-07-18 07:11:03 -03:00
|
|
|
frame. This lets you jump back and execute code again, or jump forward to
|
|
|
|
skip code that you don't want to run.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
It should be noted that not all jumps are allowed -- for instance it is not
|
2007-08-15 11:28:22 -03:00
|
|
|
possible to jump into the middle of a :keyword:`for` loop or out of a
|
|
|
|
:keyword:`finally` clause.
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: l(ist) [first[, last]]
|
|
|
|
|
|
|
|
List source code for the current file. Without arguments, list 11 lines
|
2010-07-23 13:55:26 -03:00
|
|
|
around the current line or continue the previous listing. With ``.`` as
|
|
|
|
argument, list 11 lines around the current line. With one argument,
|
2010-07-18 07:11:03 -03:00
|
|
|
list 11 lines around at that line. With two arguments, list the given range;
|
|
|
|
if the second argument is less than the first, it is interpreted as a count.
|
|
|
|
|
2010-07-30 15:46:38 -03:00
|
|
|
The current line in the current frame is indicated by ``->``. If an
|
|
|
|
exception is being debugged, the line where the exception was originally
|
|
|
|
raised or propagated is indicated by ``>>``, if it differs from the current
|
|
|
|
line.
|
|
|
|
|
2024-01-22 17:40:26 -04:00
|
|
|
.. versionchanged:: 3.2
|
|
|
|
Added the ``>>`` marker.
|
2010-07-30 15:46:38 -03:00
|
|
|
|
2010-07-30 14:04:28 -03:00
|
|
|
.. pdbcommand:: ll | longlist
|
|
|
|
|
2010-07-30 15:46:38 -03:00
|
|
|
List all source code for the current function or frame. Interesting lines
|
|
|
|
are marked as for :pdbcmd:`list`.
|
2010-07-30 14:04:28 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: a(rgs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-04-12 03:18:34 -03:00
|
|
|
Print the arguments of the current function and their current values.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-10-10 18:33:43 -03:00
|
|
|
.. pdbcommand:: p expression
|
2010-07-18 07:11:03 -03:00
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
Evaluate *expression* in the current context and print its value.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-10-10 18:33:43 -03:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
``print()`` can also be used, but is not a debugger command --- this executes the
|
|
|
|
Python :func:`print` function.
|
|
|
|
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: pp expression
|
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
Like the :pdbcmd:`p` command, except the value of *expression* is
|
2010-07-18 07:11:03 -03:00
|
|
|
pretty-printed using the :mod:`pprint` module.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: whatis expression
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
Print the type of *expression*.
|
2010-07-18 07:11:03 -03:00
|
|
|
|
2010-07-30 14:04:28 -03:00
|
|
|
.. pdbcommand:: source expression
|
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
Try to get source code of *expression* and display it.
|
2010-07-30 14:04:28 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2010-12-04 12:21:42 -04:00
|
|
|
.. pdbcommand:: display [expression]
|
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
Display the value of *expression* if it changed, each time execution stops
|
2010-12-04 12:21:42 -04:00
|
|
|
in the current frame.
|
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
Without *expression*, list all display expressions for the current frame.
|
2010-12-04 12:21:42 -04:00
|
|
|
|
2023-04-12 03:18:34 -03:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
Display evaluates *expression* and compares to the result of the previous
|
|
|
|
evaluation of *expression*, so when the result is mutable, display may not
|
|
|
|
be able to pick up the changes.
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
|
|
|
lst = []
|
|
|
|
breakpoint()
|
|
|
|
pass
|
|
|
|
lst.append(1)
|
|
|
|
print(lst)
|
|
|
|
|
|
|
|
Display won't realize ``lst`` has been changed because the result of evaluation
|
|
|
|
is modified in place by ``lst.append(1)`` before being compared::
|
|
|
|
|
|
|
|
> example.py(3)<module>()
|
|
|
|
-> pass
|
|
|
|
(Pdb) display lst
|
|
|
|
display lst: []
|
|
|
|
(Pdb) n
|
|
|
|
> example.py(4)<module>()
|
|
|
|
-> lst.append(1)
|
|
|
|
(Pdb) n
|
|
|
|
> example.py(5)<module>()
|
|
|
|
-> print(lst)
|
|
|
|
(Pdb)
|
|
|
|
|
|
|
|
You can do some tricks with copy mechanism to make it work::
|
|
|
|
|
|
|
|
> example.py(3)<module>()
|
|
|
|
-> pass
|
|
|
|
(Pdb) display lst[:]
|
|
|
|
display lst[:]: []
|
|
|
|
(Pdb) n
|
|
|
|
> example.py(4)<module>()
|
|
|
|
-> lst.append(1)
|
|
|
|
(Pdb) n
|
|
|
|
> example.py(5)<module>()
|
|
|
|
-> print(lst)
|
|
|
|
display lst[:]: [1] [old: []]
|
|
|
|
(Pdb)
|
|
|
|
|
2010-12-04 12:21:42 -04:00
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
|
|
|
.. pdbcommand:: undisplay [expression]
|
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
Do not display *expression* anymore in the current frame. Without
|
|
|
|
*expression*, clear all display expressions for the current frame.
|
2010-12-04 12:21:42 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2010-12-04 07:20:26 -04:00
|
|
|
.. pdbcommand:: interact
|
|
|
|
|
2024-05-21 00:32:15 -03:00
|
|
|
Start an interactive interpreter (using the :mod:`code` module) in a new
|
|
|
|
global namespace initialised from the local and global namespaces for the
|
|
|
|
current scope. Use ``exit()`` or ``quit()`` to exit the interpreter and
|
|
|
|
return to the debugger.
|
2023-12-07 07:19:33 -04:00
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2024-05-21 00:32:15 -03:00
|
|
|
As ``interact`` creates a new dedicated namespace for code execution,
|
|
|
|
assignments to variables will not affect the original namespaces.
|
|
|
|
However, modifications to any referenced mutable objects will be reflected
|
|
|
|
in the original namespaces as usual.
|
2010-12-04 07:20:26 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
|
2024-01-22 17:40:26 -04:00
|
|
|
.. versionchanged:: 3.13
|
|
|
|
``exit()`` and ``quit()`` can be used to exit the :pdbcmd:`interact`
|
2023-12-07 07:19:33 -04:00
|
|
|
command.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.13
|
|
|
|
:pdbcmd:`interact` directs its output to the debugger's
|
|
|
|
output channel rather than :data:`sys.stderr`.
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. _debugger-aliases:
|
|
|
|
|
|
|
|
.. pdbcommand:: alias [name [command]]
|
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
Create an alias called *name* that executes *command*. The *command* must
|
2010-07-18 07:11:03 -03:00
|
|
|
*not* be enclosed in quotes. Replaceable parameters can be indicated by
|
2023-11-04 20:05:22 -03:00
|
|
|
``%1``, ``%2``, ... and ``%9``, while ``%*`` is replaced by all the parameters.
|
2023-03-25 18:31:45 -03:00
|
|
|
If *command* is omitted, the current alias for *name* is shown. If no
|
2010-07-18 07:11:03 -03:00
|
|
|
arguments are given, all aliases are listed.
|
|
|
|
|
|
|
|
Aliases may be nested and can contain anything that can be legally typed at
|
|
|
|
the pdb prompt. Note that internal pdb commands *can* be overridden by
|
|
|
|
aliases. Such a command is then hidden until the alias is removed. Aliasing
|
|
|
|
is recursively applied to the first word of the command line; all other words
|
|
|
|
in the line are left alone.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
As an example, here are two useful aliases (especially when placed in the
|
|
|
|
:file:`.pdbrc` file)::
|
|
|
|
|
2010-07-30 05:29:39 -03:00
|
|
|
# Print instance variables (usage "pi classInst")
|
2023-03-22 08:34:52 -03:00
|
|
|
alias pi for k in %1.__dict__.keys(): print(f"%1.{k} = {%1.__dict__[k]}")
|
2010-07-30 05:29:39 -03:00
|
|
|
# Print instance variables in self
|
2007-08-15 11:28:22 -03:00
|
|
|
alias ps pi self
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: unalias name
|
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
Delete the specified alias *name*.
|
2010-07-18 07:11:03 -03:00
|
|
|
|
|
|
|
.. pdbcommand:: ! statement
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Execute the (one-line) *statement* in the context of the current stack frame.
|
|
|
|
The exclamation point can be omitted unless the first word of the statement
|
2023-05-11 14:12:02 -03:00
|
|
|
resembles a debugger command, e.g.:
|
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
|
|
|
(Pdb) ! n=42
|
|
|
|
(Pdb)
|
|
|
|
|
|
|
|
To set a global variable, you can prefix the assignment command with a
|
|
|
|
:keyword:`global` statement on the same line, e.g.:
|
|
|
|
|
|
|
|
.. code-block:: none
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
(Pdb) global list_options; list_options = ['-l']
|
|
|
|
(Pdb)
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: run [args ...]
|
|
|
|
restart [args ...]
|
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
Restart the debugged Python program. If *args* is supplied, it is split
|
2010-07-18 07:11:03 -03:00
|
|
|
with :mod:`shlex` and the result is used as the new :data:`sys.argv`.
|
|
|
|
History, breakpoints, actions and debugger options are preserved.
|
|
|
|
:pdbcmd:`restart` is an alias for :pdbcmd:`run`.
|
|
|
|
|
2024-09-25 15:18:01 -03:00
|
|
|
.. versionchanged:: 3.14
|
|
|
|
:pdbcmd:`run` and :pdbcmd:`restart` commands are disabled when the
|
|
|
|
debugger is invoked in ``'inline'`` mode.
|
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
.. pdbcommand:: q(uit)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-07-18 07:11:03 -03:00
|
|
|
Quit from the debugger. The program being executed is aborted.
|
2009-05-05 06:00:19 -03:00
|
|
|
|
2019-11-20 21:49:15 -04:00
|
|
|
.. pdbcommand:: debug code
|
|
|
|
|
2023-03-25 18:31:45 -03:00
|
|
|
Enter a recursive debugger that steps through *code*
|
|
|
|
(which is an arbitrary expression or statement to be
|
2019-11-20 21:49:15 -04:00
|
|
|
executed in the current environment).
|
|
|
|
|
|
|
|
.. pdbcommand:: retval
|
2020-06-24 18:50:49 -03:00
|
|
|
|
2023-04-12 03:18:34 -03:00
|
|
|
Print the return value for the last return of the current function.
|
2009-05-05 06:00:19 -03:00
|
|
|
|
2023-08-28 15:31:03 -03:00
|
|
|
.. pdbcommand:: exceptions [excnumber]
|
|
|
|
|
|
|
|
List or jump between chained exceptions.
|
|
|
|
|
|
|
|
When using ``pdb.pm()`` or ``Pdb.post_mortem(...)`` with a chained exception
|
|
|
|
instead of a traceback, it allows the user to move between the
|
|
|
|
chained exceptions using ``exceptions`` command to list exceptions, and
|
|
|
|
``exception <number>`` to switch to that exception.
|
|
|
|
|
|
|
|
|
|
|
|
Example::
|
|
|
|
|
|
|
|
def out():
|
|
|
|
try:
|
|
|
|
middle()
|
|
|
|
except Exception as e:
|
|
|
|
raise ValueError("reraise middle() error") from e
|
|
|
|
|
|
|
|
def middle():
|
|
|
|
try:
|
|
|
|
return inner(0)
|
|
|
|
except Exception as e:
|
|
|
|
raise ValueError("Middle fail")
|
|
|
|
|
|
|
|
def inner(x):
|
|
|
|
1 / x
|
|
|
|
|
|
|
|
out()
|
|
|
|
|
|
|
|
calling ``pdb.pm()`` will allow to move between exceptions::
|
|
|
|
|
|
|
|
> example.py(5)out()
|
|
|
|
-> raise ValueError("reraise middle() error") from e
|
|
|
|
|
|
|
|
(Pdb) exceptions
|
|
|
|
0 ZeroDivisionError('division by zero')
|
|
|
|
1 ValueError('Middle fail')
|
|
|
|
> 2 ValueError('reraise middle() error')
|
|
|
|
|
|
|
|
(Pdb) exceptions 0
|
|
|
|
> example.py(16)inner()
|
|
|
|
-> 1 / x
|
|
|
|
|
|
|
|
(Pdb) up
|
|
|
|
> example.py(10)middle()
|
|
|
|
-> return inner(0)
|
|
|
|
|
|
|
|
.. versionadded:: 3.13
|
|
|
|
|
2009-05-05 06:00:19 -03:00
|
|
|
.. rubric:: Footnotes
|
|
|
|
|
|
|
|
.. [1] Whether a frame is considered to originate in a certain module
|
|
|
|
is determined by the ``__name__`` in the frame globals.
|