diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-06-28 10:39:54 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-28 10:39:54 -0700 |
| commit | 4c20d2bf5daaaa174260558c71052b73d73b6c34 (patch) | |
| tree | 13758c04c471b8a48570c518acf551c37b22c15c /Python/context.c | |
| parent | 48dc7527e32512a27a58107477926719ea4c589b (diff) | |
| download | cpython-git-4c20d2bf5daaaa174260558c71052b73d73b6c34.tar.gz | |
bpo-33985: Implement ContextVar.name attribute. (GH-7980)
(cherry picked from commit 41cb0baea96a80360971908a0bd79d9d40dd5e44)
Co-authored-by: Yury Selivanov <yury@magic.io>
Diffstat (limited to 'Python/context.c')
| -rw-r--r-- | Python/context.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/context.c b/Python/context.c index b727748ee7..8ee048ccdd 100644 --- a/Python/context.c +++ b/Python/context.c @@ -940,6 +940,10 @@ contextvar_cls_getitem(PyObject *self, PyObject *args) Py_RETURN_NONE; } +static PyMemberDef PyContextVar_members[] = { + {"name", T_OBJECT, offsetof(PyContextVar, var_name), READONLY}, + {NULL} +}; static PyMethodDef PyContextVar_methods[] = { _CONTEXTVARS_CONTEXTVAR_GET_METHODDEF @@ -955,6 +959,7 @@ PyTypeObject PyContextVar_Type = { "ContextVar", sizeof(PyContextVar), .tp_methods = PyContextVar_methods, + .tp_members = PyContextVar_members, .tp_dealloc = (destructor)contextvar_tp_dealloc, .tp_getattro = PyObject_GenericGetAttr, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, |
