Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-32604: [_xxsubinterpreters] Propagate exceptions.#19768

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Changes from1 commit
Commits
Show all changes
16 commits
Select commitHold shift + click to select a range
3e4d56d
Add tests for error propagation.
ericsnowcurrentlyApr 23, 2020
f19008b
Add string utils.
ericsnowcurrentlyApr 27, 2020
4709f0f
Add object utils (incl. struct _objsnapshot).
ericsnowcurrentlyApr 27, 2020
185788d
Add structs _tbsnapshot and _excsnapshot.
ericsnowcurrentlyApr 27, 2020
f94e5b4
Propagate exceptions using the new utils.
ericsnowcurrentlyApr 27, 2020
e3095be
Factor out _sharedexception_get_cause() and _get_wrapper().
ericsnowcurrentlyApr 27, 2020
f3d88c9
Factor out _pyexc_create().
ericsnowcurrentlyApr 27, 2020
99a58f4
Factor out _pyexc_set_context().
ericsnowcurrentlyApr 27, 2020
40b092a
Use _PyErr_ChainExceptions() to do chaining.
ericsnowcurrentlyApr 27, 2020
5407cef
Set __context__ manually.
ericsnowcurrentlyApr 27, 2020
d9ecbeb
Drop _copy_raw_string().
ericsnowcurrentlyApr 27, 2020
54594ba
Fix RunStringTests.
ericsnowcurrentlyApr 27, 2020
a191c03
[tests] Check proper __traceback__.
ericsnowcurrentlyApr 27, 2020
6d9e383
Extract __traceback__ with the proper order.
ericsnowcurrentlyApr 28, 2020
adf4413
Fully pickle propagated exceptions.
ericsnowcurrentlyApr 28, 2020
212ac0b
Fix the "custom" exception tests.
ericsnowcurrentlyApr 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Set __context__ manually.
  • Loading branch information
@ericsnowcurrently
ericsnowcurrently committedApr 28, 2020
commit5407cefcdf98178c3fa820dd0925dd2e4ca93d22
25 changes: 3 additions & 22 deletionsModules/_xxsubinterpretersmodule.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1135,26 +1135,6 @@ _sharedexception_extract(_sharedexception *she, PyObject *exc)
Py_XDECREF(msgobj);
}

static void
_pyexc_set_context(PyObject *exc, PyObject *context)
{
PyObject *contexttype = (PyObject *)Py_TYPE(context);

// PyErr_Restore() steals references.
PyObject *exctype = (PyObject *)Py_TYPE(exc);
Py_INCREF(exctype);
Py_INCREF(exc);
PyObject *tb = PyException_GetTraceback(exc);
PyErr_Restore(exctype, exc, tb); // This is needed for chaining.

Py_INCREF(contexttype); // _PyErr_ChainExceptions() steals a reference.
// This sets exc.__context__ to "context".
_PyErr_ChainExceptions(contexttype, context,
PyException_GetTraceback(context));

PyErr_Clear(); // We had only set it temporarily for chaining.
}

static PyObject *
_sharedexception_resolve(_sharedexception *sharedexc, PyObject *wrapperclass)
{
Expand All@@ -1167,8 +1147,9 @@ _sharedexception_resolve(_sharedexception *sharedexc, PyObject *wrapperclass)
// Set __cause__, is possible.
PyObject *cause = _sharedexception_get_cause(sharedexc);
if (cause != NULL) {
// Set __context__ automatically.
_pyexc_set_context(exc, cause);
// Set __context__.
Py_INCREF(cause); // PyException_SetContext() steals a reference.
PyException_SetContext(exc, cause);

// Set __cause__.
Py_INCREF(cause); // PyException_SetCause() steals a reference.
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp