Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 87 additions & 1 deletion Python/clinic/context.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 13 additions & 11 deletions Python/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,19 +994,20 @@ class _contextvars.ContextVar "PyContextVar *" "&PyContextVar_Type"
#define _PyContextVar_CAST(op) ((PyContextVar *)(op))


/*[clinic input]
@vectorcall
@classmethod
_contextvars.ContextVar.__new__ as contextvar_tp_new
name: object
/
*
default as def: object = NULL
[clinic start generated code]*/

static PyObject *
contextvar_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
contextvar_tp_new_impl(PyTypeObject *type, PyObject *name, PyObject *def)
/*[clinic end generated code: output=1c8af17a14fc9dc2 input=d5e8cf845a1ddc27]*/
{
static char *kwlist[] = {"", "default", NULL};
PyObject *name;
PyObject *def = NULL;

if (!PyArg_ParseTupleAndKeywords(
args, kwds, "O|$O:ContextVar", kwlist, &name, &def))
{
return NULL;
}

return (PyObject *)contextvar_new(name, def);
}

Expand Down Expand Up @@ -1200,6 +1201,7 @@ PyTypeObject PyContextVar_Type = {
.tp_traverse = contextvar_tp_traverse,
.tp_clear = contextvar_tp_clear,
.tp_new = contextvar_tp_new,
.tp_vectorcall = contextvar_tp_vectorcall,
.tp_free = PyObject_GC_Del,
.tp_hash = contextvar_tp_hash,
.tp_repr = contextvar_tp_repr,
Expand Down
Loading