diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2019-12-07 11:23:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-07 11:23:21 (GMT) |
commit | 969ae7aca809a8dacafee04c261110eea0ac1945 (patch) | |
tree | 80a150dd627ca4aa61025f21146d50d7a90b3de8 /Modules | |
parent | 7ddcd0caa4c2e6b43265df144f59c5aa508a94f2 (diff) | |
download | cpython-969ae7aca809a8dacafee04c261110eea0ac1945.zip cpython-969ae7aca809a8dacafee04c261110eea0ac1945.tar.gz cpython-969ae7aca809a8dacafee04c261110eea0ac1945.tar.bz2 |
Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python version (GH-17484)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_asynciomodule.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 2d14744..70da40a 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -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 * @@ -3266,7 +3282,7 @@ module_init(void) } if (module_initialized != 0) { return 0; - } + } else { module_initialized = 1; } |