bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497)



now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None. 


https://bugs.python.org/issue38979



Automerge-Triggered-By: @asvetlov
diff --git a/Python/context.c b/Python/context.c
index 26f2299..e0338c9 100644
--- a/Python/context.c
+++ b/Python/context.c
@@ -1024,9 +1024,10 @@
 
 
 static PyObject *
-contextvar_cls_getitem(PyObject *self, PyObject *args)
+contextvar_cls_getitem(PyObject *self, PyObject *arg)
 {
-    Py_RETURN_NONE;
+    Py_INCREF(self);
+    return self;
 }
 
 static PyMemberDef PyContextVar_members[] = {
@@ -1039,7 +1040,7 @@
     _CONTEXTVARS_CONTEXTVAR_SET_METHODDEF
     _CONTEXTVARS_CONTEXTVAR_RESET_METHODDEF
     {"__class_getitem__", contextvar_cls_getitem,
-        METH_VARARGS | METH_STATIC, NULL},
+        METH_O | METH_CLASS, NULL},
     {NULL, NULL}
 };