-
Notifications
You must be signed in to change notification settings - Fork 782
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
send errors in __releasebuffer__
to sys.unraisablehook
#2886
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
davidhewitt
force-pushed
the
releasebuffer-cleanup
branch
from
January 18, 2023 20:53
6b31ed7
to
5f44d64
Compare
Thanks as always for the thorough review! I've pushed a commit which should address all of those points and hopefully pass CI. |
adamreichold
approved these changes
Jan 18, 2023
davidhewitt
force-pushed
the
releasebuffer-cleanup
branch
from
January 19, 2023 07:46
5f44d64
to
0bc9e49
Compare
bors r=adamreichold |
bors bot
added a commit
that referenced
this pull request
Jan 19, 2023
2886: send errors in `__releasebuffer__` to `sys.unraisablehook` r=adamreichold a=davidhewitt I noticed that in the `__releasebuffer__` implementation we currently diverge from documentation by allowing `-> PyResult<()>` return values, but they cause crashes later down the line. e.g. without the other changes in this PR, the new test case would crash with the following message: ``` ValueError: oh dear The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<string>", line 1, in <module> SystemError: <class 'bytes'> returned a result with an exception set ``` After some deliberation I decided to allow `-> PyResult<()>` returns because: - it keeps the macro implementation and usage simpler - errors might be produced by the `__releasebuffer__` internals anyway (e.g. due to `PyCell` locking, or invalid self type passed) As a result, this PR cleans up the case discussed to send errors to `sys.unraisablehook`, and updates the documentation to be clearer on the allowed behaviour. Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
davidhewitt
force-pushed
the
releasebuffer-cleanup
branch
from
January 19, 2023 08:34
0bc9e49
to
78c8ac1
Compare
Canceled. |
bors r+ |
bors bot
added a commit
that referenced
this pull request
Jan 19, 2023
2886: send errors in `__releasebuffer__` to `sys.unraisablehook` r=davidhewitt a=davidhewitt I noticed that in the `__releasebuffer__` implementation we currently diverge from documentation by allowing `-> PyResult<()>` return values, but they cause crashes later down the line. e.g. without the other changes in this PR, the new test case would crash with the following message: ``` ValueError: oh dear The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<string>", line 1, in <module> SystemError: <class 'bytes'> returned a result with an exception set ``` After some deliberation I decided to allow `-> PyResult<()>` returns because: - it keeps the macro implementation and usage simpler - errors might be produced by the `__releasebuffer__` internals anyway (e.g. due to `PyCell` locking, or invalid self type passed) As a result, this PR cleans up the case discussed to send errors to `sys.unraisablehook`, and updates the documentation to be clearer on the allowed behaviour. Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
davidhewitt
force-pushed
the
releasebuffer-cleanup
branch
from
January 19, 2023 08:56
78c8ac1
to
2748d92
Compare
Canceled. |
bors r=adamreichold |
bors bot
added a commit
that referenced
this pull request
Jan 19, 2023
2886: send errors in `__releasebuffer__` to `sys.unraisablehook` r=adamreichold a=davidhewitt I noticed that in the `__releasebuffer__` implementation we currently diverge from documentation by allowing `-> PyResult<()>` return values, but they cause crashes later down the line. e.g. without the other changes in this PR, the new test case would crash with the following message: ``` ValueError: oh dear The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<string>", line 1, in <module> SystemError: <class 'bytes'> returned a result with an exception set ``` After some deliberation I decided to allow `-> PyResult<()>` returns because: - it keeps the macro implementation and usage simpler - errors might be produced by the `__releasebuffer__` internals anyway (e.g. due to `PyCell` locking, or invalid self type passed) As a result, this PR cleans up the case discussed to send errors to `sys.unraisablehook`, and updates the documentation to be clearer on the allowed behaviour. Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
Build failed: |
davidhewitt
force-pushed
the
releasebuffer-cleanup
branch
from
January 19, 2023 19:15
2748d92
to
586fed2
Compare
bors r=adamreichold |
Build succeeded:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that in the
__releasebuffer__
implementation we currently diverge from documentation by allowing-> PyResult<()>
return values, but they cause crashes later down the line.e.g. without the other changes in this PR, the new test case would crash with the following message:
After some deliberation I decided to allow
-> PyResult<()>
returns because:__releasebuffer__
internals anyway (e.g. due toPyCell
locking, or invalid self type passed)As a result, this PR cleans up the case discussed to send errors to
sys.unraisablehook
, and updates the documentation to be clearer on the allowed behaviour.