Skip to content

bpo-40795: ctypes calls unraisablehook with an exception #20452

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

Merged
merged 1 commit into from
May 27, 2020
Merged

bpo-40795: ctypes calls unraisablehook with an exception #20452

merged 1 commit into from
May 27, 2020

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented May 27, 2020

If ctypes fails to convert the result of a callback or if a ctypes
callback function raises an exception, sys.unraisablehook is now
called with an exception set. Previously, the error was logged into
stderr by PyErr_Print().

https://bugs.python.org/issue40795

@vstinner
Copy link
Member Author

I tested manually: the change doesn't introduce any reference leak:

$ ./python -m test -R 3:3 test_ctypes
0:00:00 load avg: 0.71 Run tests sequentially
0:00:00 load avg: 0.71 [1/1] test_ctypes
beginning 6 repetitions
123456
......

== Tests result: SUCCESS ==

1 test OK.

Total duration: 10.2 sec
Tests result: SUCCESS

If ctypes fails to convert the result of a callback or if a ctypes
callback function raises an exception, sys.unraisablehook is now
called with an exception set. Previously, the error was logged into
stderr by PyErr_Print().
@vstinner vstinner merged commit 10228ba into python:master May 27, 2020
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@vstinner vstinner deleted the ctypes_unraisable branch May 27, 2020 22:38
@bedevere-bot
Copy link

GH-20469 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label May 27, 2020
@bedevere-bot
Copy link

GH-20470 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 27, 2020
)

If ctypes fails to convert the result of a callback or if a ctypes
callback function raises an exception, sys.unraisablehook is now
called with an exception set. Previously, the error was logged into
stderr by PyErr_Print().
(cherry picked from commit 10228ba)

Co-authored-by: Victor Stinner <[email protected]>
miss-islington added a commit that referenced this pull request May 27, 2020
If ctypes fails to convert the result of a callback or if a ctypes
callback function raises an exception, sys.unraisablehook is now
called with an exception set. Previously, the error was logged into
stderr by PyErr_Print().
(cherry picked from commit 10228ba)

Co-authored-by: Victor Stinner <[email protected]>
miss-islington added a commit that referenced this pull request May 27, 2020
If ctypes fails to convert the result of a callback or if a ctypes
callback function raises an exception, sys.unraisablehook is now
called with an exception set. Previously, the error was logged into
stderr by PyErr_Print().
(cherry picked from commit 10228ba)

Co-authored-by: Victor Stinner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants