Change signature to breakpoint(*args, **kws)

This commit is contained in:
Barry Warsaw 2017-09-07 11:27:55 -07:00
parent 9df19f27eb
commit b2c6a25160
1 changed files with 16 additions and 15 deletions

View File

@ -6,7 +6,7 @@ Type: Standards Track
Content-Type: text/x-rst
Created: 2017-09-05
Python-Version: 3.7
Post-History:
Post-History: 2017-09-05, 2017-09-07
Abstract
@ -61,8 +61,6 @@ above would be written like so::
breakpoint()
bar()
Built-in ``breakpoint()`` takes no arguments.
Further, this PEP proposes two new name bindings for the ``sys``
module, called ``sys.breakpointhook()`` and
``sys.__breakpointhook__``. By default, ``sys.breakpointhook()``
@ -74,9 +72,11 @@ This exactly models the existing ``sys.displayhook()`` /
``sys.__displayhook__`` and ``sys.excepthook()`` /
``sys.__excepthook__`` hooks [3]_.
``sys.breakpointhook()`` would be called with no arguments. It
returns whatever is returned from the underlying debugger entry point.
``breakpoint()`` returns whatever ``sys.breakpointhook()`` returns.
The signature of the built-in is ``breakpoint(*args, **kws)``. The positional
and keyword arguments are passed straight through to ``sys.breakpointhook()``
and the signatures must match or you will get a ``TypeError``. The return
from ``sys.breakpointhook()`` is passed back up to, and returned from
``breakpoint()``.
Open issues
@ -101,15 +101,6 @@ bytecode streams to trampoline into their own debugger. Having a
in order to invoke this trampoline. *NOTE*: It probably makes sense to split
this idea into a separate PEP.
Breakpoint arguments
--------------------
Does it make sense to define the built-in function's signature as
``breakpoint(*args, **kws)`` which would just be passed along to the
``sys.breakpointhook()``? One argument for doing this is that it
would allow users to pass useful arguments to their actual debugger.
This isn't useful for ``pdb`` but might be useful for alternatives.
Environment variable
--------------------
@ -175,6 +166,16 @@ just requires more typing and would lead to::
which inherits several of the problems this PEP aims to solve.
Version History
===============
* 2017-09-07
* ``debug()`` renamed to ``breakpoint()``
* Signature changed to ``breakpoint(*args, **kws)`` which is passed straight
through to ``sys.breakpointhook()``.
References
==========