Skip to content

Commit ba5cf46

Browse files
author
Anselm Kruis
committed
merge 3.3-slp (Stackless python#129, PyTasklet_New( NULL, ...))
2 parents ca4b16a + 3a45703 commit ba5cf46

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

Doc/c-api/stackless.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Tasklets
1010

1111
.. c:function:: PyTaskletObject *PyTasklet_New(PyTypeObject *type, PyObject *func)
1212
13-
Return a new tasklet object. *type* must be derived from :c:type:`PyTasklet_Type`
14-
or *NULL*. *func* must be a callable object (normal use-case) or *NULL*, if the
15-
tasklet is being used via capture().
13+
Return a new tasklet object. *type* must be derived from :c:type:`PyTasklet_Type`
14+
or ``NULL``. *func* must be a callable object or ``NULL`` or :c:macro:`Py_None`. If *func*
15+
is ``NULL`` or :c:macro:`Py_None` you must set it later with :c:func:`PyTasklet_BindEx`.
1616
1717
.. todo: in the case where NULL is returned and slp_ensure_linkage fails no
1818
exception is set, which is in contrast elsewhere in the function.

Stackless/changelog.txt

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

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

12+
- https://bitbucket.org/stackless-dev/stackless/issues/129
13+
C-API: Calling PyTasklet_New( NULL, ...) no longer crashes.
14+
1215
- https://bitbucket.org/stackless-dev/stackless/issues/128
1316
Fix pickling of the module 'stackless'.
1417

Stackless/module/taskletobject.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,14 @@ tasklet_dealloc(PyTaskletObject *t)
216216
PyTaskletObject *
217217
PyTasklet_New(PyTypeObject *type, PyObject *func)
218218
{
219+
if (type == NULL) {
220+
type = &PyTasklet_Type;
221+
}
219222
if (!PyType_IsSubtype(type, &PyTasklet_Type)) {
220223
PyErr_SetNone(PyExc_TypeError);
221224
return NULL;
222225
}
223-
if (func)
226+
if (func && func != Py_None)
224227
return (PyTaskletObject*)PyObject_CallFunctionObjArgs((PyObject*)type, func, NULL);
225228
else
226229
return (PyTaskletObject*)PyObject_CallFunction((PyObject*)type, NULL);

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