Testing and Diagnostics Modules

pdb

Interactive source debugger for inspecting frames and variables, setting breakpoints and stepping through Python code. Commands may evaluate Python expressions in the debugged process, so do not expose a debugger to untrusted users. The example queries a debugger object without pausing execution.

Formal Syntax & Structure

python syntaxpython
import pdb

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from pdb import Pdbfrom io import StringIOdebugger = Pdb(stdin=StringIO(), stdout=StringIO(), readrc=False)print(callable(debugger.do_next))
Python Reference