Skip to content

Commit 719edbe

Browse files
author
Anselm Kruis
committed
merge 3.4-slp (Stackless python#70)
2 parents bb41389 + 476232b commit 719edbe

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

Objects/abstract.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2746,6 +2746,7 @@ PyIter_Next(PyObject *iter)
27462746
STACKLESS_PROMOTE_METHOD(iter, tp_iternext);
27472747
result = (*iter->ob_type->tp_iternext)(iter);
27482748
STACKLESS_ASSERT();
2749+
STACKLESS_ASSERT_UNWINDING_VALUE_IS_NOT(result, NULL);
27492750
if (result == NULL &&
27502751
PyErr_Occurred() &&
27512752
PyErr_ExceptionMatches(PyExc_StopIteration))

Objects/typeobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5480,6 +5480,7 @@ wrap_next(PyObject *self, PyObject *args, void *wrapped)
54805480
STACKLESS_PROMOTE_ALL();
54815481
res = (*func)(self);
54825482
STACKLESS_ASSERT();
5483+
STACKLESS_ASSERT_UNWINDING_VALUE_IS_NOT(res, NULL);
54835484
if (res == NULL && !PyErr_Occurred())
54845485
PyErr_SetNone(PyExc_StopIteration);
54855486
return res;

Stackless/core/stackless_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ PyAPI_FUNC(PyTaskletObject *) slp_get_watchdog(PyThreadState *ts, int interrupt)
181181
#define STACKLESS_RETVAL(obj) \
182182
(STACKLESS_UNWINDING(obj) ? Py_UnwindToken->tempval : (obj))
183183

184+
#define STACKLESS_ASSERT_UNWINDING_VALUE_IS_NOT(obj, val) \
185+
assert(!STACKLESS_UNWINDING(obj) || ((Py_UnwindToken->tempval) != (val)))
186+
184187
/* macros for setting/resetting the stackless flag */
185188

186189
#define STACKLESS_GETARG() int stackless = (stackless = slp_try_stackless, \
@@ -555,6 +558,7 @@ PyObject * slp_get_channel_callback(void);
555558
#define STACKLESS_ASSERT() assert(1)
556559

557560
#define STACKLESS_RETVAL(obj) (obj)
561+
#define STACKLESS_ASSERT_UNWINDING_VALUE_IS_NOT(val) assert(1)
558562

559563
#define STACKLESS_DECLARE_METHOD(type, meth)
560564

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy