[Python-Dev] breakpoint() and $PYTHONBREAKPOINT
Barry Warsaw
barry at python.org
Sun Sep 10 15:06:09 EDT 2017
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 $PYTHONBREAKPOINT.
Feedback welcome.
-Barry
[*] Probably not $PYTHONBREAKPOINTHOOK although if we choose to implement that in sys.breakpointhook(), it might still makes sense.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 273 bytes
Desc: Message signed with OpenPGP
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170910/0f451f0e/attachment.sig>
More information about the Python-Dev
mailing list