Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bb320b1

Browse filesBrowse files
author
Anselm Kruis
committed
Stackless issue python#133: fix Python/ceval.c
The previous merge broke Python/ceval.c.
1 parent 412045d commit bb320b1
Copy full SHA for bb320b1

File tree

1 file changed

+22
-4
lines changed
Filter options

1 file changed

+22
-4
lines changed

‎Python/ceval.c

Copy file name to clipboardExpand all lines: Python/ceval.c
+22-4Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3634,8 +3634,14 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
36343634
res = call_function(&sp, oparg, names);
36353635
#endif
36363636
stack_pointer = sp;
3637-
PUSH(res);
36383637
Py_DECREF(names);
3638+
#ifdef STACKLESS
3639+
if (STACKLESS_UNWINDING(res)) {
3640+
retval = res;
3641+
goto stackless_call;
3642+
}
3643+
#endif
3644+
PUSH(res);
36393645

36403646
if (res == NULL) {
36413647
goto error;
@@ -3660,6 +3666,13 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
36603666
Py_DECREF(func);
36613667
Py_DECREF(callargs);
36623668
Py_XDECREF(kwargs);
3669+
#ifdef STACKLESS
3670+
if (STACKLESS_UNWINDING(result)) {
3671+
retval = result;
3672+
POP(); /* compensate for the PUSH(res) after label stackless_call_return: */
3673+
goto stackless_call;
3674+
}
3675+
#endif
36633676

36643677
SET_TOP(result);
36653678
if (result == NULL) {
@@ -5507,13 +5520,13 @@ call_function(PyObject ***pp_stack, Py_ssize_t oparg, PyObject *names
55075520
}
55085521
else {
55095522
Py_INCREF(func);
5510-
STACKLESS_ASSERT();
55115523
}
55125524

55135525
READ_TIMESTAMP(*pintr0);
55145526
if (PyFunction_Check(func)) {
55155527
STACKLESS_PROPOSE_ALL();
55165528
x = fast_function(func, pp_stack, nargs, names);
5529+
STACKLESS_ASSERT();
55175530
} else {
55185531
x = do_call(func, pp_stack, nargs, names);
55195532
}
@@ -5837,6 +5850,7 @@ do_call(PyObject *func, PyObject ***pp_stack, Py_ssize_t nargs, PyObject *kwname
58375850
static PyObject *
58385851
do_call_core(PyObject *func, PyObject *callargs, PyObject *kwdict)
58395852
{
5853+
PyObject *result;
58405854
#ifdef CALL_PROFILE
58415855
/* At this point, we have to look at the type of func to
58425856
update the call stats properly. Do it here so as to avoid
@@ -5853,15 +5867,19 @@ do_call_core(PyObject *func, PyObject *callargs, PyObject *kwdict)
58535867
else
58545868
PCALL(PCALL_OTHER);
58555869
#endif
5870+
5871+
STACKLESS_PROPOSE_ALL();
58565872
if (PyCFunction_Check(func)) {
5857-
PyObject *result;
58585873
PyThreadState *tstate = PyThreadState_GET();
58595874
C_TRACE(result, PyCFunction_Call(func, callargs, kwdict));
58605875
return result;
58615876
}
58625877
else {
5863-
return PyObject_Call(func, callargs, kwdict);
5878+
result = PyObject_Call(func, callargs, kwdict);
58645879
}
5880+
STACKLESS_ASSERT();
5881+
5882+
return result;
58655883
}
58665884

58675885
/* Extract a slice index from a PyLong or an object with the

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.