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

Skip to content

Commit 373f8d8

Browse files
committed
LOAD_FAST: rearrange branches to favor the expected case, and get
rid of a redundant NULL-pointer check in the expected case.
1 parent 7ba5e81 commit 373f8d8

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

Python/ceval.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,17 +1666,14 @@ eval_frame(PyFrameObject *f)
16661666

16671667
case LOAD_FAST:
16681668
x = GETLOCAL(oparg);
1669-
if (x == NULL) {
1670-
format_exc_check_arg(
1671-
PyExc_UnboundLocalError,
1672-
UNBOUNDLOCAL_ERROR_MSG,
1673-
PyTuple_GetItem(co->co_varnames, oparg)
1674-
);
1675-
break;
1669+
if (x != NULL) {
1670+
Py_INCREF(x);
1671+
PUSH(x);
1672+
continue;
16761673
}
1677-
Py_INCREF(x);
1678-
PUSH(x);
1679-
if (x != NULL) continue;
1674+
format_exc_check_arg(PyExc_UnboundLocalError,
1675+
UNBOUNDLOCAL_ERROR_MSG,
1676+
PyTuple_GetItem(co->co_varnames, oparg));
16801677
break;
16811678

16821679
case STORE_FAST:

0 commit comments

Comments
 (0)