Skip to content

del sys.breakpointhook is not tested in test_builtin #96197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
youknowone opened this issue Aug 23, 2022 · 3 comments
Closed

del sys.breakpointhook is not tested in test_builtin #96197

youknowone opened this issue Aug 23, 2022 · 3 comments
Labels
tests Tests in the Lib/test dir

Comments

@youknowone
Copy link
Contributor

youknowone commented Aug 23, 2022

Bug report

test_builtin::TestBreakpoint contains various scenario of breakpointhook setup, but missing deleted hook test.
Adding a new test will prevent a future regression.

Your environment

Not applicable.

@youknowone youknowone added the type-bug An unexpected behavior, bug, or error label Aug 23, 2022
youknowone added a commit to youknowone/cpython that referenced this issue Aug 23, 2022
@corona10 corona10 added tests Tests in the Lib/test dir and removed type-bug An unexpected behavior, bug, or error labels Aug 23, 2022
@warsaw
Copy link
Member

warsaw commented Aug 23, 2022

The semantics of del sys.breakpointhook isn't well defined, either in PEP 553 or in the stdlib docs. However the intent is for it to act similarly to sys.displayhook and sys.excepthook, except that those aren't entirely consistent either:

Python 3.10.6 (main, Aug 11 2022, 13:49:25) [Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> del sys.displayhook
>>> repr(object())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: lost sys.displayhook
>>> del sys.excepthook
>>> 1/0
sys.excepthook is missing
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: division by zero

del sys.displayhook produces a RuntimeError but del sys.excepthook does not (you get the original exception). This all makes sense, and in the case of del sys.breakpointhook I suppose it should act more like del sys.displayhook, which it does.

All that to say, I wonder if these behaviors should be documented in sys module documentation?

@corona10 corona10 reopened this Aug 23, 2022
@corona10
Copy link
Member

All that to say, I wonder if these behaviors should be documented in sys module documentation?

Agree

@youknowone
Copy link
Contributor Author

Thank you, that sounds great to me.

corona10 added a commit to corona10/cpython that referenced this issue Aug 24, 2022
corona10 added a commit to corona10/cpython that referenced this issue Aug 24, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 24, 2022
…ok is lost (pythongh-96231)

(cherry picked from commit 09563a7)

Co-authored-by: Dong-hee Na <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 24, 2022
…ok is lost (pythongh-96231)

(cherry picked from commit 09563a7)

Co-authored-by: Dong-hee Na <[email protected]>
miss-islington added a commit that referenced this issue Aug 24, 2022
…lost (gh-96231)

(cherry picked from commit 09563a7)

Co-authored-by: Dong-hee Na <[email protected]>
miss-islington added a commit that referenced this issue Aug 24, 2022
…lost (gh-96231)

(cherry picked from commit 09563a7)

Co-authored-by: Dong-hee Na <[email protected]>
mdboom pushed a commit to mdboom/cpython that referenced this issue Aug 24, 2022
mdboom pushed a commit to mdboom/cpython that referenced this issue Aug 24, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 26, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 26, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 26, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 26, 2022
miss-islington added a commit that referenced this issue Aug 26, 2022
miss-islington added a commit that referenced this issue Aug 26, 2022
miss-islington added a commit that referenced this issue Aug 26, 2022
ambv pushed a commit that referenced this issue Oct 5, 2022
…sing (gh-96293) (#96294)

(cherry picked from commit 47d406f)

Co-authored-by: Dong-hee Na <[email protected]>
pablogsal pushed a commit that referenced this issue Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir
Projects
None yet
Development

No branches or pull requests

3 participants