File tree Expand file tree Collapse file tree 1 file changed +13
-16
lines changed
Expand file tree Collapse file tree 1 file changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -633,17 +633,14 @@ framelocalsproxy_items(PyObject *self, PyObject *Py_UNUSED(ignored))
633633 if (value ) {
634634 PyObject * pair = _PyTuple_FromPairSteal (Py_NewRef (name ), value );
635635 if (pair == NULL ) {
636- Py_DECREF (items );
637- return NULL ;
638- }
639-
640- if (PyList_Append (items , pair ) < 0 ) {
641- Py_DECREF (items );
642- Py_DECREF (pair );
643- return NULL ;
636+ goto error ;
644637 }
645638
639+ int rc = PyList_Append (items , pair );
646640 Py_DECREF (pair );
641+ if (rc < 0 ) {
642+ goto error ;
643+ }
647644 }
648645 }
649646
@@ -655,21 +652,21 @@ framelocalsproxy_items(PyObject *self, PyObject *Py_UNUSED(ignored))
655652 while (PyDict_Next (frame -> f_extra_locals , & j , & key , & value )) {
656653 PyObject * pair = _PyTuple_FromPair (key , value );
657654 if (pair == NULL ) {
658- Py_DECREF (items );
659- return NULL ;
660- }
661-
662- if (PyList_Append (items , pair ) < 0 ) {
663- Py_DECREF (items );
664- Py_DECREF (pair );
665- return NULL ;
655+ goto error ;
666656 }
667657
658+ int rc = PyList_Append (items , pair );
668659 Py_DECREF (pair );
660+ if (rc < 0 ) {
661+ goto error ;
662+ }
669663 }
670664 }
671665
672666 return items ;
667+ error :
668+ Py_DECREF (items );
669+ return NULL ;
673670}
674671
675672static Py_ssize_t
You can’t perform that action at this time.
0 commit comments