FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-45711: Remove unnecessary normalization of exc_info by iritkatriel · Pull Request #29922 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or 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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:c:func:`_PyErr_ChainStackItem` no longer normalizes ``exc_info`` (including setting the traceback on the exception instance) because ``exc_info`` is always normalized.
20 changes: 0 additions & 20 deletions Python/errors.c
This file contains hidden or 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
Original file line number Diff line number Diff line change
Expand Up @@ -647,26 +647,6 @@ _PyErr_ChainStackItem(_PyErr_StackItem *exc_info)
PyObject *typ, *val, *tb;
_PyErr_Fetch(tstate, &typ, &val, &tb);

PyObject *typ2, *val2, *tb2;
typ2 = exc_info->exc_type;
val2 = exc_info->exc_value;
tb2 = exc_info->exc_traceback;
#ifdef Py_DEBUG
PyObject *typ2_before = typ2;
PyObject *val2_before = val2;
PyObject *tb2_before = tb2;
#endif
_PyErr_NormalizeException(tstate, &typ2, &val2, &tb2);
#ifdef Py_DEBUG
/* exc_info should already be normalized */
assert(typ2 == typ2_before);
assert(val2 == val2_before);
assert(tb2 == tb2_before);
#endif
if (tb2 != NULL) {
PyException_SetTraceback(val2, tb2);
}

/* _PyErr_SetObject sets the context from PyThreadState. */
_PyErr_SetObject(tstate, typ, val);
Py_DECREF(typ); // since _PyErr_Occurred was true
Expand Down

Back | FazBrowse Home | New Git URL