File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2626,7 +2626,7 @@ _PyErr_TrySetFromCause(const char *format, ...)
26262626 PyObject * msg_prefix ;
26272627 PyObject * exc , * val , * tb ;
26282628 PyTypeObject * caught_type ;
2629- PyObject * instance_dict ;
2629+ PyObject * * dictptr ;
26302630 PyObject * instance_args ;
26312631 Py_ssize_t num_args ;
26322632 PyObject * new_exc , * new_val , * new_tb ;
@@ -2664,8 +2664,10 @@ _PyErr_TrySetFromCause(const char *format, ...)
26642664 }
26652665
26662666 /* Ensure the instance dict is also empty */
2667- instance_dict = * _PyObject_GetDictPtr (val );
2668- if (instance_dict != NULL && PyObject_Length (instance_dict ) > 0 ) {
2667+ dictptr = _PyObject_GetDictPtr (val );
2668+ if ((dictptr != NULL ) && (* dictptr != NULL ) &&
2669+ (PyObject_Length (* dictptr ) > 0 )
2670+ ) {
26692671 /* While we could potentially copy a non-empty instance dictionary
26702672 * to the replacement exception, for now we take the more
26712673 * conservative path of leaving exceptions with attributes set
You can’t perform that action at this time.
0 commit comments