Change signature to breakpoint(*args, **kws)
This commit is contained in:
parent
9df19f27eb
commit
b2c6a25160
31
pep-0553.rst
31
pep-0553.rst
|
@ -6,7 +6,7 @@ Type: Standards Track
|
||||||
Content-Type: text/x-rst
|
Content-Type: text/x-rst
|
||||||
Created: 2017-09-05
|
Created: 2017-09-05
|
||||||
Python-Version: 3.7
|
Python-Version: 3.7
|
||||||
Post-History:
|
Post-History: 2017-09-05, 2017-09-07
|
||||||
|
|
||||||
|
|
||||||
Abstract
|
Abstract
|
||||||
|
@ -61,8 +61,6 @@ above would be written like so::
|
||||||
breakpoint()
|
breakpoint()
|
||||||
bar()
|
bar()
|
||||||
|
|
||||||
Built-in ``breakpoint()`` takes no arguments.
|
|
||||||
|
|
||||||
Further, this PEP proposes two new name bindings for the ``sys``
|
Further, this PEP proposes two new name bindings for the ``sys``
|
||||||
module, called ``sys.breakpointhook()`` and
|
module, called ``sys.breakpointhook()`` and
|
||||||
``sys.__breakpointhook__``. By default, ``sys.breakpointhook()``
|
``sys.__breakpointhook__``. By default, ``sys.breakpointhook()``
|
||||||
|
@ -74,9 +72,11 @@ This exactly models the existing ``sys.displayhook()`` /
|
||||||
``sys.__displayhook__`` and ``sys.excepthook()`` /
|
``sys.__displayhook__`` and ``sys.excepthook()`` /
|
||||||
``sys.__excepthook__`` hooks [3]_.
|
``sys.__excepthook__`` hooks [3]_.
|
||||||
|
|
||||||
``sys.breakpointhook()`` would be called with no arguments. It
|
The signature of the built-in is ``breakpoint(*args, **kws)``. The positional
|
||||||
returns whatever is returned from the underlying debugger entry point.
|
and keyword arguments are passed straight through to ``sys.breakpointhook()``
|
||||||
``breakpoint()`` returns whatever ``sys.breakpointhook()`` returns.
|
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
|
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
|
in order to invoke this trampoline. *NOTE*: It probably makes sense to split
|
||||||
this idea into a separate PEP.
|
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
|
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.
|
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
|
References
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue