Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Python

breakpoint()

Invokes the current breakpoint hook, which normally enters the configured debugger.

Version: Python 3.14; repository image, production runtime not attested

Syntax

breakpoint(*args, **kwargs)

Invokes the current breakpoint hook, which normally enters the configured debugger.

The hook is replaceable. Installing a local recording hook allows an unattended program to observe the arguments without starting an interactive session.

Calls the current sys.breakpointhook with the given positional and keyword arguments and returns its result. The default hook consults PYTHONBREAKPOINT and normally starts the debugger. The sample temporarily installs a printing function, producing checkpoint without interaction, and restores the previous hook in finally.

import sys
old = sys.breakpointhook
try:
    sys.breakpointhook = lambda *, label: label.upper()
    assert breakpoint(label="ready") == "READY"
finally:
    sys.breakpointhook = old

Examples

import sys

previous = sys.breakpointhook
try:
    sys.breakpointhook = lambda label: print(label)
    breakpoint("checkpoint")
finally:
    sys.breakpointhook = previous

Result

checkpoint

Calls the current sys.breakpointhook with the given positional and keyword arguments and returns its result. The default hook consults PYTHONBREAKPOINT and normally starts the debugger. The sample temporarily installs a printing function, producing checkpoint without interaction, and restores the previous hook in finally.

Sources