From c2ae6e3ca26c88ea43ce19bce5bc5d2e3d2b14c0 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 30 Sep 2024 08:06:52 -0700 Subject: [PATCH] Apply suggestions from code review --- Python/compile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Python/compile.c b/Python/compile.c index 78d107ea198e0e..7d93f2a05f66d9 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2546,9 +2546,11 @@ compiler_class_body(struct compiler *c, stmt_ty s, int firstlineno) assert(c->u->u_static_attributes); PyObject *static_attributes_unsorted = PySequence_List(c->u->u_static_attributes); if (static_attributes_unsorted == NULL) { + compiler_exit_scope(c); return ERROR; } if (PyList_Sort(static_attributes_unsorted) != 0) { + compiler_exit_scope(c); Py_DECREF(static_attributes_unsorted); return ERROR; }