File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2683,20 +2683,24 @@ _PyErr_TrySetFromCause(const char *format, ...)
26832683 * state potentially stored on OSError instances.
26842684 */
26852685
2686+ Py_DECREF (exc );
2687+ Py_XDECREF (tb );
2688+
26862689#ifdef HAVE_STDARG_PROTOTYPES
26872690 va_start (vargs , format );
26882691#else
26892692 va_start (vargs );
26902693#endif
26912694 msg_prefix = PyUnicode_FromFormatV (format , vargs );
26922695 va_end (vargs );
2693- if (msg_prefix == NULL )
2696+ if (msg_prefix == NULL ) {
2697+ Py_DECREF (val );
26942698 return NULL ;
2699+ }
26952700
26962701 PyErr_Format (exc , "%U (%s: %S)" ,
26972702 msg_prefix , Py_TYPE (val )-> tp_name , val );
2698- Py_DECREF (exc );
2699- Py_XDECREF (tb );
2703+ Py_DECREF (msg_prefix );
27002704 PyErr_Fetch (& new_exc , & new_val , & new_tb );
27012705 PyErr_NormalizeException (& new_exc , & new_val , & new_tb );
27022706 PyException_SetCause (new_val , val );
You can’t perform that action at this time.
0 commit comments