Skip to content

Commit 9ea2c93

Browse files
author
Anselm Kruis
committed
Stackless issue python#79: fix the exception raised on missing arguments
Fixed tasklet.raise_exception and channel.send_exception to raise a correct TypeError, if called without arguments. (grafted from d8e8ff8b72508dd3c642d8aa3ff82065daf01abf)
1 parent a80d383 commit 9ea2c93

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

Stackless/changelog.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ What's New in Stackless 3.X.X?
1010

1111
*Release date: 20XX-XX-XX*
1212

13+
- https://bitbucket.org/stackless-dev/stackless/issue/79
14+
Add __all__ to module stackless. Add entries to the module's __dict__
15+
for the computed properties (i.e. current, main, ...). This helps IDEs
16+
(PyDev) to recognise the expression "stackless.current" as a defined name.
17+
Fixed tasklet.raise_exception and channel.send_exception to raise a correct
18+
TypeError, if called without arguments.
19+
1320
- https://bitbucket.org/stackless-dev/stackless/issue/77
1421
Fix a NULL pointer exception, if a call to stackless.tasklet() fails
1522
(i.e. called with invalid arguments).

Stackless/module/channelobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ channel_send_exception(PyObject *myself, PyObject *args)
651651
PyObject *klass = PySequence_GetItem(args, 0);
652652

653653
if (klass == NULL)
654-
VALUE_ERROR("channel.send_exception(e, v...)", NULL);
654+
TYPE_ERROR("send_exception() takes at least 1 argument", NULL);
655655
args = PySequence_GetSlice(args, 1, PySequence_Size(args));
656656
if (!args) {
657657
goto err_exit;
@@ -780,7 +780,7 @@ PyChannel_Receive(PyChannelObject *self)
780780
{
781781
PyObject *ret = impl_channel_receive(self);
782782
STACKLESS_ASSERT();
783-
assert(!STACKLESS_UNWINDING(self));
783+
assert(!STACKLESS_UNWINDING(ret));
784784
return ret;
785785
}
786786

Stackless/module/taskletobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ tasklet_raise_exception(PyObject *myself, PyObject *args)
11911191
PyObject *klass = PySequence_GetItem(args, 0);
11921192

11931193
if (klass == NULL)
1194-
VALUE_ERROR("tasklet.raise_exception(e, v...)", NULL);
1194+
TYPE_ERROR("raise_exception() takes at least 1 argument", NULL);
11951195
args = PySequence_GetSlice(args, 1, PySequence_Size(args));
11961196
if (!args) goto err_exit;
11971197
STACKLESS_PROMOTE_ALL();

0 commit comments

Comments
 (0)