mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
GH-118095: Handle RETURN_GENERATOR
in tier 2 (GH-118180)
This commit is contained in:
parent
10bb90ed49
commit
f180b31e76
16 changed files with 143 additions and 81 deletions
|
@ -110,7 +110,17 @@ _PyFrame_NumSlotsForCodeObject(PyCodeObject *code)
|
|||
return code->co_framesize - FRAME_SPECIALS_SIZE;
|
||||
}
|
||||
|
||||
void _PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *dest);
|
||||
static inline void _PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *dest)
|
||||
{
|
||||
assert(src->stacktop >= _PyFrame_GetCode(src)->co_nlocalsplus);
|
||||
*dest = *src;
|
||||
for (int i = 1; i < src->stacktop; i++) {
|
||||
dest->localsplus[i] = src->localsplus[i];
|
||||
}
|
||||
// Don't leave a dangling pointer to the old frame when creating generators
|
||||
// and coroutines:
|
||||
dest->previous = NULL;
|
||||
}
|
||||
|
||||
/* Consumes reference to func and locals.
|
||||
Does not initialize frame->previous, which happens
|
||||
|
@ -256,7 +266,7 @@ _PyThreadState_HasStackSpace(PyThreadState *tstate, int size)
|
|||
extern _PyInterpreterFrame *
|
||||
_PyThreadState_PushFrame(PyThreadState *tstate, size_t size);
|
||||
|
||||
void _PyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFrame *frame);
|
||||
PyAPI_FUNC(void) _PyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFrame *frame);
|
||||
|
||||
/* Pushes a frame without checking for space.
|
||||
* Must be guarded by _PyThreadState_HasStackSpace()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue