bpo-45256: Rationalize code around Python-to-Python calls a bit. (GH-29235)

This commit is contained in:
Mark Shannon 2021-10-28 16:14:59 +01:00 committed by GitHub
parent 0a1a36b74b
commit 7f61d9d848
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 121 additions and 70 deletions

View file

@ -152,6 +152,21 @@ _PyFrame_LocalsToFast(InterpreterFrame *frame, int clear);
InterpreterFrame *_PyThreadState_PushFrame(
PyThreadState *tstate, PyFrameConstructor *con, PyObject *locals);
extern InterpreterFrame *
_PyThreadState_BumpFramePointerSlow(PyThreadState *tstate, size_t size);
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;
}
return _PyThreadState_BumpFramePointerSlow(tstate, size);
}
void _PyThreadState_PopFrame(PyThreadState *tstate, InterpreterFrame *frame);
#ifdef __cplusplus