From f3b7c1615515095f27a8a0e10409a36ca46abcc5 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Fri, 3 May 2024 07:40:42 -0600 Subject: [PATCH] review comments --- Python/compile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Python/compile.c b/Python/compile.c index 8450fb7a9dfe52..ba256652393eb1 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -5503,9 +5503,12 @@ push_inlined_comprehension_state(struct compiler *c, location loc, long scope = (symbol >> SCOPE_OFFSET) & SCOPE_MASK; PyObject *outv = PyDict_GetItemWithError(c->u->u_ste->ste_symbols, k); if (outv == NULL) { + if (PyErr_Occurred()) { + return ERROR; + } outv = _PyLong_GetZero(); } - assert(PyLong_Check(outv)); + assert(PyLong_CheckExact(outv)); long outsc = (PyLong_AS_LONG(outv) >> SCOPE_OFFSET) & SCOPE_MASK; // If a name has different scope inside than outside the comprehension, // we need to temporarily handle it with the right scope while