Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4c2580 commit 4b9b936Copy full SHA for 4b9b936
1 file changed
Objects/exceptions.c
@@ -2685,7 +2685,6 @@ _PyErr_TrySetFromCause(const char *format, ...)
2685
* state potentially stored on OSError instances.
2686
*/
2687
2688
- Py_DECREF(exc);
2689
Py_XDECREF(tb);
2690
2691
#ifdef HAVE_STDARG_PROTOTYPES
@@ -2696,12 +2695,14 @@ _PyErr_TrySetFromCause(const char *format, ...)
2696
2695
msg_prefix = PyUnicode_FromFormatV(format, vargs);
2697
va_end(vargs);
2698
if (msg_prefix == NULL) {
+ Py_DECREF(exc);
2699
Py_DECREF(val);
2700
return NULL;
2701
}
2702
2703
PyErr_Format(exc, "%U (%s: %S)",
2704
msg_prefix, Py_TYPE(val)->tp_name, val);
2705
2706
Py_DECREF(msg_prefix);
2707
PyErr_Fetch(&new_exc, &new_val, &new_tb);
2708
PyErr_NormalizeException(&new_exc, &new_val, &new_tb);
0 commit comments