]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.7] Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python...
authorAndrew Svetlov <andrew.svetlov@gmail.com>
Sat, 7 Dec 2019 11:46:18 +0000 (13:46 +0200)
committerGitHub <noreply@github.com>
Sat, 7 Dec 2019 11:46:18 +0000 (13:46 +0200)
(cherry picked from commit 969ae7aca809a8dacafee04c261110eea0ac1945)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst [new file with mode: 0644]
Modules/_asynciomodule.c

diff --git a/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst b/Misc/NEWS.d/next/Library/2019-12-06-15-11-42.bpo-38986.bg6iZt.rst
new file mode 100644 (file)
index 0000000..7775352
--- /dev/null
@@ -0,0 +1,2 @@
+Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python
+version.
index 99d5f1d8596ef0852c7ccf1603591dfb866f150e..441506bc82a14b394d26c51e3908fad85631d1fe 100644 (file)
@@ -1821,6 +1821,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",
@@ -1832,6 +1847,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 *