mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
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
This commit is contained in:
parent
00ada2c1d5
commit
28c91631c2
3 changed files with 9 additions and 6 deletions
|
@ -1024,9 +1024,10 @@ _contextvars_ContextVar_reset(PyContextVar *self, PyObject *token)
|
|||
|
||||
|
||||
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 @@ static PyMethodDef PyContextVar_methods[] = {
|
|||
_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}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue