[Python-Dev] breakpoint() and $PYTHONBREAKPOINT

Guido van Rossum guido at python.org
Sun Sep 10 15:16:05 EDT 2017

I think programmatic overrides should be able to decide for themselves if
they want to honor PYTHONBREAKPOINT or not, since I can imagine use cases
that go both ways. So it should be checked in sys.breakpointhook().

On Sun, Sep 10, 2017 at 12:06 PM, Barry Warsaw <barry at python.org> wrote:

> For PEP 553, I think it’s a good idea to support the environment variable
> $PYTHONBREAKPOINT[*] but I’m stuck on a design question, so I’d like to get
> some feedback.
> Should $PYTHONBREAKPOINT be consulted in breakpoint() or in
> sys.breakpointhook()?
> If we support it in breakpoint() then it means if $PYTHONBREAKPOINT is
> set, Python will never call sys.breakpointhook() so programmatic override
> of that will be ignored.
> If we support it in sys.breakpointhook(), then if you programmatically
> override that, $PYTHONBREAKPOINT will be ignored even if set.  Of course,
> any code that overrides sys.breakpointhook() could also consult
> $PYTHONBREAKPOINT if they want.
> So how do we want it to work?  It seems like explicit code should override
> the environment variable, which should override the default, meaning that
> $PYTHONBREAKPOINT should be consulted only in breakpoint().  And if you set
> sys.breakpointhook() with something else, then oh well, Python just ignores
> Feedback welcome.
> -Barry
> [*] Probably not $PYTHONBREAKPOINTHOOK although if we choose to implement
> that in sys.breakpointhook(), it might still makes sense.
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> guido%40python.org

--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170910/773a063e/attachment.html>

More information about the Python-Dev mailing list