summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/pystate.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index a11f162..1c96f4f 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -2195,15 +2195,12 @@ _PyInterpreterFrame *
_PyThreadState_PushFrame(PyThreadState *tstate, size_t size)
{
assert(size < INT_MAX/sizeof(PyObject *));
- PyObject **base = tstate->datastack_top;
- PyObject **top = base + size;
- if (top >= tstate->datastack_limit) {
- base = push_chunk(tstate, (int)size);
+ if (_PyThreadState_HasStackSpace(tstate, (int)size)) {
+ _PyInterpreterFrame *res = (_PyInterpreterFrame *)tstate->datastack_top;
+ tstate->datastack_top += size;
+ return res;
}
- else {
- tstate->datastack_top = top;
- }
- return (_PyInterpreterFrame *)base;
+ return (_PyInterpreterFrame *)push_chunk(tstate, (int)size);
}
void