Skip to content
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

bpo-39164: errors: add and expose _PyErr_GetExcInfo #17752

Merged
merged 1 commit into from Jan 13, 2020

Conversation

jd
Copy link
Contributor

@jd jd commented Dec 30, 2019

This adds a new function named _PyErr_GetExcInfo that is a variation of the
original PyErr_GetExcInfo taking a PyThreadState as its first argument.
That function allows to retrieve the exceptions information of any Python
thread — not only the current one.

https://bugs.python.org/issue39164

@jd
Copy link
Contributor Author

jd commented Jan 13, 2020

@vstinner just in case you missed it 👋 :)

Python/errors.c Outdated Show resolved Hide resolved
Python/errors.c Show resolved Hide resolved
Include/pyerrors.h Outdated Show resolved Hide resolved
This adds a new function named _PyErr_GetExcInfo that is a variation of the
original PyErr_GetExcInfo taking a PyThreadState as its first argument.
That function allows to retrieve the exceptions information of any Python
thread — not only the current one.
@jd jd requested a review from vstinner January 13, 2020 16:24
@jd
Copy link
Contributor Author

jd commented Jan 13, 2020

Failure looks unrelated 🤔

@vstinner
Copy link
Member

test_ttk_guionly failed twice on Azure Pipelines "Tests / Ubuntu":

...
1 test failed:
    test_ttk_guionly
...
0:09:11 load avg: 1.55 Re-running test_ttk_guionly in verbose mode
patchlevel = 8.6.8
...
test_values (tkinter.test.test_ttk.test_widgets.ComboboxTest) ... ok
test_virtual_event (tkinter.test.test_ttk.test_widgets.ComboboxTest) ... Timeout (0:20:00)!
Thread 0x00007fb9e022b080 (most recent call first):
  File "/home/runner/work/cpython/cpython/Lib/tkinter/__init__.py", line 697 in wait_visibility
  File "/home/runner/work/cpython/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 452 in test_virtual_event
  File "/home/runner/work/cpython/cpython/Lib/unittest/case.py", line 616 in _callTestMethod
  ...

@vstinner vstinner merged commit 3430c55 into python:master Jan 13, 2020
@vstinner
Copy link
Member

Thanks @jd, I merged your PR. I made minor changes on your commit message.

@jd jd deleted the expose-PyErr_GetExcInfo branch January 13, 2020 16:43
@jd
Copy link
Contributor Author

jd commented Jan 13, 2020

Thank you @vstinner 🙇

PyErr_GetExcInfo(PyObject **p_type, PyObject **p_value, PyObject **p_traceback)
{
PyThreadState *tstate = _PyThreadState_GET();
return _PyErr_GetExcInfo(tstate, p_type, p_value, p_traceback);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have a return? I think this introduced a warning on the windows build: https://github.com/python/cpython/runs/390021032#step:3:572

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I wrote PR #18010 to fix the warning.

shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
This adds a new function named _PyErr_GetExcInfo() that is a variation of the
original PyErr_GetExcInfo() taking a PyThreadState as its first argument.
That function allows to retrieve the exceptions information of any Python
thread -- not only the current one.
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.

None yet

5 participants