[Python-Dev] PEP 553; the interaction between $PYTHONBREAKPOINT and -E

Serhiy Storchaka storchaka at gmail.com
Thu Oct 5 04:17:46 EDT 2017

04.10.17 21:06, Barry Warsaw пише:
> Victor brings up a good question in his review of the PEP 553 implementation.
> https://github.com/python/cpython/pull/3355
> https://bugs.python.org/issue31353
> The question is whether $PYTHONBREAKPOINT should be ignored if -E is given?
> I think it makes sense for $PYTHONBREAKPOINT to be sensitive to -E, but in thinking about it some more, it might make better sense for the semantics to be that when -E is given, we treat it like PYTHONBREAKPOINT=0, i.e. disable the breakpoint, rather than fallback to the `pdb.set_trace` default.
> My thinking is this: -E is often used in production environments to prevent stray environment settings from affecting the Python process.  In those environments, you probably also want to prevent stray breakpoints from stopping the process, so it’s more helpful to disable breakpoint processing when -E is given rather than running pdb.set_trace().
> If you have a strong opinion either way, please follow up here, on the PR, or on the bug tracker.

What if make the default value depending on the debug level? In debug 
mode it is "pdb.set_trace", in optimized mode it is "0". Then in 
production environments you can use -E -O for ignoring environment 
settings and disable breakpoints.

More information about the Python-Dev mailing list