Python Glossary Русский

Python 3.14+sysfunction

sys.is_remote_debug_enabled()

debugging and tracing

Returns True if a remote debugger can attach to this process (sys.remote_exec, python -m pdb -p PID). New in Python 3.14.

Syntax

sys.is_remote_debug_enabled()

The default answer is True: attaching is blocked by the PYTHON_DISABLE_REMOTE_DEBUG environment variable, the -X disable-remote-debug option (with hyphens!) or a --without-remote-debug build. The typo -X disable_remote_debug with underscores is silently ignored, and the protection stays off. The function reports only the interpreter's own readiness: it does not check OS permissions (ptrace on Linux, root on macOS).

Examples

import sys
print(sys.is_remote_debug_enabled())  # → ? True — если не запрещено
import subprocess, sys
code = 'import sys; print(sys.is_remote_debug_enabled())'
for opt in ('disable-remote-debug', 'disable_remote_debug'):
    r = subprocess.run([sys.executable, '-X', opt, '-c', code],
                       capture_output=True, text=True, timeout=10)
    print(opt, r.stdout.strip())
# → ? disable-remote-debug False / disable_remote_debug True

See also

Open in the full glossarydocs.python.orgReport an inaccuracy