This repository was archived by the owner on Feb 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,9 @@ Tasklets
10
10
11
11
.. c :function :: PyTaskletObject *PyTasklet_New (PyTypeObject *type, PyObject *func)
12
12
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 ` .
16
16
17
17
.. todo: in the case where NULL is returned and slp_ensure_linkage fails no
18
18
exception is set, which is in contrast elsewhere in the function.
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ What's New in Stackless 3.X.X?
9
9
10
10
*Release date: 20XX-XX-XX*
11
11
12
+ - https://bitbucket.org/stackless-dev/stackless/issues/129
13
+ C-API: Calling PyTasklet_New( NULL, ...) no longer crashes.
14
+
12
15
- https://bitbucket.org/stackless-dev/stackless/issues/128
13
16
Fix pickling of the module 'stackless'.
14
17
Original file line number Diff line number Diff line change @@ -216,11 +216,14 @@ tasklet_dealloc(PyTaskletObject *t)
216
216
PyTaskletObject *
217
217
PyTasklet_New (PyTypeObject * type , PyObject * func )
218
218
{
219
+ if (type == NULL ) {
220
+ type = & PyTasklet_Type ;
221
+ }
219
222
if (!PyType_IsSubtype (type , & PyTasklet_Type )) {
220
223
PyErr_SetNone (PyExc_TypeError );
221
224
return NULL ;
222
225
}
223
- if (func )
226
+ if (func && func != Py_None )
224
227
return (PyTaskletObject * )PyObject_CallFunctionObjArgs ((PyObject * )type , func , NULL );
225
228
else
226
229
return (PyTaskletObject * )PyObject_CallFunction ((PyObject * )type , NULL );
You can’t perform that action at this time.
0 commit comments