diff options
author | Brandt Bucher <brandt@python.org> | 2021-12-28 17:49:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-28 17:49:48 (GMT) |
commit | 77195cd44b2506cda88a3cfc98918526068b1d46 (patch) | |
tree | 30575945241f9b941e57395c82f25fbfefd13310 /Include | |
parent | 02b5417f1107415abaf81acab7522f9aa84269ea (diff) | |
download | cpython-77195cd44b2506cda88a3cfc98918526068b1d46.zip cpython-77195cd44b2506cda88a3cfc98918526068b1d46.tar.gz cpython-77195cd44b2506cda88a3cfc98918526068b1d46.tar.bz2 |
bpo-46090: Allow PyThreadState.datastack_* members to be NULL (GH-30234)
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_frame.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Include/internal/pycore_frame.h b/Include/internal/pycore_frame.h index 883bef1..8eca39d 100644 --- a/Include/internal/pycore_frame.h +++ b/Include/internal/pycore_frame.h @@ -174,10 +174,13 @@ static inline InterpreterFrame * _PyThreadState_BumpFramePointer(PyThreadState *tstate, size_t size) { PyObject **base = tstate->datastack_top; - PyObject **top = base + size; - if (top < tstate->datastack_limit) { - tstate->datastack_top = top; - return (InterpreterFrame *)base; + if (base) { + PyObject **top = base + size; + assert(tstate->datastack_limit); + if (top < tstate->datastack_limit) { + tstate->datastack_top = top; + return (InterpreterFrame *)base; + } } return _PyThreadState_BumpFramePointerSlow(tstate, size); } |