Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python version (GH-17484)

This commit is contained in:
Andrew Svetlov 2019-12-07 13:23:21 +02:00 committed by GitHub
parent 7ddcd0caa4
commit 969ae7aca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,2 @@
Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python
version.

View File

@ -1815,6 +1815,21 @@ TaskWakeupMethWrapper_dealloc(TaskWakeupMethWrapper *o)
Py_TYPE(o)->tp_free(o);
}
static PyObject *
TaskWakeupMethWrapper_get___self__(TaskWakeupMethWrapper *o, void *Py_UNUSED(ignored))
{
if (o->ww_task) {
Py_INCREF(o->ww_task);
return (PyObject*)o->ww_task;
}
Py_RETURN_NONE;
}
static PyGetSetDef TaskWakeupMethWrapper_getsetlist[] = {
{"__self__", (getter)TaskWakeupMethWrapper_get___self__, NULL, NULL},
{NULL} /* Sentinel */
};
static PyTypeObject TaskWakeupMethWrapper_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"TaskWakeupMethWrapper",
@ -1826,6 +1841,7 @@ static PyTypeObject TaskWakeupMethWrapper_Type = {
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
.tp_traverse = (traverseproc)TaskWakeupMethWrapper_traverse,
.tp_clear = (inquiry)TaskWakeupMethWrapper_clear,
.tp_getset = TaskWakeupMethWrapper_getsetlist,
};
static PyObject *