summaryrefslogtreecommitdiff
path: root/Python/clinic/context.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Python/clinic/context.c.h')
-rw-r--r--Python/clinic/context.c.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/Python/clinic/context.c.h b/Python/clinic/context.c.h
index 32b1883ebe..bbe19db1bd 100644
--- a/Python/clinic/context.c.h
+++ b/Python/clinic/context.c.h
@@ -25,11 +25,15 @@ _contextvars_Context_get(PyContext *self, PyObject *const *args, Py_ssize_t narg
PyObject *key;
PyObject *default_value = Py_None;
- if (!_PyArg_UnpackStack(args, nargs, "get",
- 1, 2,
- &key, &default_value)) {
+ if (!_PyArg_CheckPositional("get", nargs, 1, 2)) {
goto exit;
}
+ key = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ default_value = args[1];
+skip_optional:
return_value = _contextvars_Context_get_impl(self, key, default_value);
exit:
@@ -134,11 +138,14 @@ _contextvars_ContextVar_get(PyContextVar *self, PyObject *const *args, Py_ssize_
PyObject *return_value = NULL;
PyObject *default_value = NULL;
- if (!_PyArg_UnpackStack(args, nargs, "get",
- 0, 1,
- &default_value)) {
+ if (!_PyArg_CheckPositional("get", nargs, 0, 1)) {
goto exit;
}
+ if (nargs < 1) {
+ goto skip_optional;
+ }
+ default_value = args[0];
+skip_optional:
return_value = _contextvars_ContextVar_get_impl(self, default_value);
exit:
@@ -170,4 +177,4 @@ PyDoc_STRVAR(_contextvars_ContextVar_reset__doc__,
#define _CONTEXTVARS_CONTEXTVAR_RESET_METHODDEF \
{"reset", (PyCFunction)_contextvars_ContextVar_reset, METH_O, _contextvars_ContextVar_reset__doc__},
-/*[clinic end generated code: output=9c93e22bcadbaa2b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=67c3a8f76b6cf4e7 input=a9049054013a1b77]*/