diff options
author | mpage <mpage@meta.com> | 2024-08-21 12:16:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-21 12:16:30 (GMT) |
commit | 50a595b37fe3201cd07701ffdda9d6baa6163562 (patch) | |
tree | 0b0f5a46b4789f96f8c2d18f037f398af965011f /Python/bytecodes.c | |
parent | 159db050f429da0bc847949b273ff25b8941943c (diff) | |
download | cpython-50a595b37fe3201cd07701ffdda9d6baa6163562.zip cpython-50a595b37fe3201cd07701ffdda9d6baa6163562.tar.gz cpython-50a595b37fe3201cd07701ffdda9d6baa6163562.tar.bz2 |
[3.13] gh-122712: Guard against __code__ reassignment in CALL_ALLOC_AND_ENTER_INIT (GH-122713) (GH-123184)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r-- | Python/bytecodes.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 1a41c7e..cac9f67 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -3407,6 +3407,8 @@ dummy_func( PyFunctionObject *init = (PyFunctionObject *)cls->_spec_cache.init; PyCodeObject *code = (PyCodeObject *)init->func_code; DEOPT_IF(code->co_argcount != oparg+1); + DEOPT_IF((code->co_flags & (CO_VARKEYWORDS | CO_VARARGS | CO_OPTIMIZED)) != CO_OPTIMIZED); + DEOPT_IF(code->co_kwonlyargcount); DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize + _Py_InitCleanup.co_framesize)); STAT_INC(CALL, hit); PyObject *self = _PyType_NewManagedObject(tp); |