Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 1c7ff3e

Browse files
author
Anselm Kruis
committed
Issue #112: Prepare Stackless 3.5, fix PEP492 for Stackless
Fix various issues introduced by merging the PEP 492 implementation from default. https://bitbucket.org/stackless-dev/stackless/issues/112
1 parent ac32e1e commit 1c7ff3e

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

Objects/genobject.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,18 @@ gen_throw(PyGenObject *gen, PyObject *args)
422422
static PyObject *
423423
gen_iternext(PyGenObject *gen)
424424
{
425+
STACKLESS_GETARG();
426+
PyObject *retval;
425427
if (((PyCodeObject*)gen->gi_code)->co_flags & CO_COROUTINE) {
426428
PyErr_SetString(PyExc_TypeError,
427429
"coroutine-objects do not support iteration");
428430
return NULL;
429431
}
430432

431-
return gen_send_ex(gen, NULL, 0);
433+
STACKLESS_PROMOTE_ALL();
434+
retval = gen_send_ex(gen, NULL, 0);
435+
STACKLESS_ASSERT();
436+
return retval;
432437
}
433438

434439
/*

Objects/typeobject.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6485,6 +6485,7 @@ slot_tp_finalize(PyObject *self)
64856485
static PyObject *
64866486
slot_am_await(PyObject *self)
64876487
{
6488+
STACKLESS_GETARG(); /* not supported */
64886489
PyObject *func, *res;
64896490
_Py_IDENTIFIER(__await__);
64906491

@@ -6503,6 +6504,7 @@ slot_am_await(PyObject *self)
65036504
static PyObject *
65046505
slot_am_aiter(PyObject *self)
65056506
{
6507+
STACKLESS_GETARG(); /* not supported */
65066508
PyObject *func, *res;
65076509
_Py_IDENTIFIER(__aiter__);
65086510

@@ -6521,6 +6523,7 @@ slot_am_aiter(PyObject *self)
65216523
static PyObject *
65226524
slot_am_anext(PyObject *self)
65236525
{
6526+
STACKLESS_GETARG(); /* not supported */
65246527
PyObject *func, *res;
65256528
_Py_IDENTIFIER(__anext__);
65266529

Python/ceval.c

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
/* enable more aggressive intra-module optimizations, where available */
10-
#define PY_LOCAL_AGGRESSIVE
10+
#undef PY_LOCAL_AGGRESSIVE
1111

1212
#include "Python.h"
1313

@@ -1772,28 +1772,20 @@ slp_eval_frame_value(PyFrameObject *f, int throwflag, PyObject *retval)
17721772
}
17731773
}
17741774
else if (f->f_execute == slp_eval_frame_with_cleanup) {
1775-
/* finalise the WITH_CLEANUP operation */
1776-
1775+
/* finalise the WITH_CLEANUP_START operation */
17771776
if (retval) {
1778-
PyObject *u = TOP();
1779-
int err;
1780-
if (u != Py_None)
1781-
err = PyObject_IsTrue(retval);
1782-
else
1783-
err = 0;
1784-
Py_DECREF(retval);
1785-
1786-
if (err > 0) {
1787-
err = 0;
1788-
/* There was an exception and a True return */
1789-
PUSH(PyLong_FromLong((long) WHY_SILENCED));
1790-
}
1791-
/* XXX: The main loop contains a PREDICT(END_FINALLY).
1777+
/* recompute exc */
1778+
PyObject *exc = TOP();
1779+
if (PyLong_Check(exc))
1780+
exc = Py_None;
1781+
PUSH(exc);
1782+
PUSH(retval);
1783+
/* XXX: The main loop contains a PREDICT(WITH_CLEANUP_FINISH);
17921784
* I wonder, if we must use it here?
17931785
* If so, then set f_execute too.
17941786
*/
17951787
/*f->f_execute = PyEval_EvalFrame_value;
1796-
PREDICT(END_FINALLY); */
1788+
PREDICT(WITH_CLEANUP_FINISH); */
17971789
}
17981790
}
17991791
else {

Stackless/core/stacklesseval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ gen_iternext_callback(PyFrameObject *f, int exc, PyObject *result)
11221122
* a leaking StopIteration into RuntimeError (with its cause
11231123
* set appropriately). */
11241124
if ((((PyCodeObject *)gen->gi_code)->co_flags &
1125-
CO_FUTURE_GENERATOR_STOP)
1125+
(CO_FUTURE_GENERATOR_STOP | CO_COROUTINE | CO_ITERABLE_COROUTINE))
11261126
&& PyErr_ExceptionMatches(PyExc_StopIteration))
11271127
{
11281128
PyObject *exc, *val, *val2, *tb;

0 commit comments

Comments
 (0)