Skip to content

Commit 0e14a6d

Browse files
committed
assert deferred_anno is not empty
1 parent 850601a commit 0e14a6d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Python/codegen.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*/
1414

1515
#include "Python.h"
16+
#include "listobject.h"
1617
#include "opcode.h"
1718
#include "pycore_ast.h" // _PyAST_GetDocString()
1819
#define NEED_OPCODE_TABLES
@@ -825,9 +826,7 @@ codegen_process_deferred_annotations(compiler *c, location loc)
825826
void *key = (void *)((uintptr_t)ste->ste_id + 1);
826827

827828
// Get the first annotation location
828-
if (PyList_GET_SIZE(deferred_anno) == 0) {
829-
goto error;
830-
}
829+
assert(PyList_GET_SIZE(deferred_anno) > 0);
831830
PyObject* ptr = PyList_GET_ITEM(deferred_anno, 0);
832831
stmt_ty st = (stmt_ty)PyLong_AsVoidPtr(ptr);
833832
if (st == NULL) {

0 commit comments

Comments
 (0)