Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2e4c899

Browse files
committed
DELETE_FAST should issue an exception when the local variable is undefined.
1 parent 1a87e9d commit 2e4c899

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Python/ceval.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,13 @@ eval_code2(co, globals, locals,
13371337
continue;
13381338

13391339
case DELETE_FAST:
1340+
x = GETLOCAL(oparg);
1341+
if (x == NULL) {
1342+
PyErr_SetObject(PyExc_NameError,
1343+
PyTuple_GetItem(co->co_varnames,
1344+
oparg));
1345+
break;
1346+
}
13401347
SETLOCAL(oparg, NULL);
13411348
continue;
13421349

0 commit comments

Comments
 (0)