Skip to content

Commit f3739b9

Browse files
Anselm Kruisakruis
authored andcommitted
Stackless issue python#265: fix the signature of tp_clear functions
Return type is 'int', not 'void'.
1 parent 10c8679 commit f3739b9

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

Stackless/core/cframeobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ cframe_traverse(PyCFrameObject *cf, visitproc visit, void *arg)
6666

6767
/* clearing a cframe while the object still exists */
6868

69-
static void
69+
static int
7070
cframe_clear(PyCFrameObject *cf)
7171
{
7272
/* The Python C-API documentation recomends to use Py_CLEAR() to release
@@ -86,6 +86,7 @@ cframe_clear(PyCFrameObject *cf)
8686
Py_XDECREF(tmp_ob1);
8787
Py_XDECREF(tmp_ob2);
8888
Py_XDECREF(tmp_ob3);
89+
return 0;
8990
}
9091

9192

Stackless/module/channelobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ channel_traverse(PyChannelObject *ch, visitproc visit, void *arg)
5656
return 0;
5757
}
5858

59-
static void
59+
static int
6060
channel_clear(PyObject *ob)
6161
{
6262
PyChannelObject *ch = (PyChannelObject *) ob;
@@ -74,6 +74,7 @@ channel_clear(PyObject *ob)
7474
ob = (PyObject *) slp_channel_remove(ch, NULL, NULL, NULL);
7575
Py_DECREF(ob);
7676
}
77+
return 0;
7778
}
7879

7980
static void

Stackless/module/scheduling.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ bomb_traverse(PyBombObject *bomb, visitproc visit, void *arg)
4242
return 0;
4343
}
4444

45-
static void
45+
static int
4646
bomb_clear(PyBombObject *bomb)
4747
{
4848
Py_CLEAR(bomb->curexc_type);
4949
Py_CLEAR(bomb->curexc_value);
5050
Py_CLEAR(bomb->curexc_traceback);
51+
return 0;
5152
}
5253

5354
PyBombObject *

Stackless/module/taskletobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ exc_state_clear(_PyErr_StackItem *exc_state)
197197
Py_XDECREF(tb);
198198
}
199199

200-
static void
200+
static int
201201
tasklet_clear(PyTaskletObject *t)
202202
{
203203
tasklet_clear_frames(t);
@@ -219,6 +219,7 @@ tasklet_clear(PyTaskletObject *t)
219219
* the order of calls to tp_clear is undefined.
220220
*/
221221
t->exc_info = &t->exc_state;
222+
return 0;
222223
}
223224

224225
/*

Stackless/pickling/prickelpit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,13 @@ _wrap_traverse(PyObject *ob, visitproc visit, void *arg)
129129
return ret;
130130
}
131131

132-
static void
132+
static int
133133
_wrap_clear(PyObject *ob)
134134
{
135135
Py_TYPE(ob) = Py_TYPE(ob)->tp_base;
136136
if (Py_TYPE(ob)->tp_clear != NULL)
137137
Py_TYPE(ob)->tp_clear(ob);
138+
return 0;
138139
}
139140

140141

0 commit comments

Comments
 (0)