diff options
author | Ken Jin <kenjin@python.org> | 2024-09-13 16:23:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-13 16:23:51 (GMT) |
commit | 8810e286fa48876422d1b230208911decbead294 (patch) | |
tree | 0d171d70418884104b8681e0e7492d136b8b6778 /Python/bytecodes.c | |
parent | 74330d992be26829dba65ab83d698d42b2f2a2ee (diff) | |
download | cpython-8810e286fa48876422d1b230208911decbead294.zip cpython-8810e286fa48876422d1b230208911decbead294.tar.gz cpython-8810e286fa48876422d1b230208911decbead294.tar.bz2 |
gh-121459: Deferred LOAD_GLOBAL (GH-123128)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Sam Gross <655866+colesbury@users.noreply.github.com>
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r-- | Python/bytecodes.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 078f06d..846404e 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1469,8 +1469,8 @@ dummy_func( && PyDict_CheckExact(BUILTINS())) { v_o = _PyDict_LoadGlobal((PyDictObject *)GLOBALS(), - (PyDictObject *)BUILTINS(), - name); + (PyDictObject *)BUILTINS(), + name); if (v_o == NULL) { if (!_PyErr_Occurred(tstate)) { /* _PyDict_LoadGlobal() returns NULL without raising @@ -1526,12 +1526,12 @@ dummy_func( #endif /* ENABLE_SPECIALIZATION */ } - op(_LOAD_GLOBAL, ( -- res, null if (oparg & 1))) { + // res[1] because we need a pointer to res to pass it to _PyEval_LoadGlobalStackRef + op(_LOAD_GLOBAL, ( -- res[1], null if (oparg & 1))) { PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); - PyObject *res_o = _PyEval_LoadGlobal(GLOBALS(), BUILTINS(), name); - ERROR_IF(res_o == NULL, error); + _PyEval_LoadGlobalStackRef(GLOBALS(), BUILTINS(), name, res); + ERROR_IF(PyStackRef_IsNull(*res), error); null = PyStackRef_NULL; - res = PyStackRef_FromPyObjectSteal(res_o); } macro(LOAD_GLOBAL) = |