/src/cpython/Objects/clinic/sentinelobject.c.h
Line | Count | Source |
1 | | /*[clinic input] |
2 | | preserve |
3 | | [clinic start generated code]*/ |
4 | | |
5 | | #include "pycore_modsupport.h" // _PyArg_CheckPositional() |
6 | | |
7 | | static PyObject * |
8 | | sentinel_new_impl(PyTypeObject *type, PyObject *name); |
9 | | |
10 | | static PyObject * |
11 | | sentinel_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) |
12 | 47 | { |
13 | 47 | PyObject *return_value = NULL; |
14 | 47 | PyTypeObject *base_tp = &PySentinel_Type; |
15 | 47 | PyObject *name; |
16 | | |
17 | 47 | if ((type == base_tp || type->tp_init == base_tp->tp_init) && |
18 | 47 | !_PyArg_NoKeywords("sentinel", kwargs)) { |
19 | 0 | goto exit; |
20 | 0 | } |
21 | 47 | if (!_PyArg_CheckPositional("sentinel", PyTuple_GET_SIZE(args), 1, 1)) { |
22 | 0 | goto exit; |
23 | 0 | } |
24 | 47 | if (!PyUnicode_Check(PyTuple_GET_ITEM(args, 0))) { |
25 | 0 | _PyArg_BadArgument("sentinel", "argument 1", "str", PyTuple_GET_ITEM(args, 0)); |
26 | 0 | goto exit; |
27 | 0 | } |
28 | 47 | name = PyTuple_GET_ITEM(args, 0); |
29 | 47 | return_value = sentinel_new_impl(type, name); |
30 | | |
31 | 47 | exit: |
32 | 47 | return return_value; |
33 | 47 | } |
34 | | /*[clinic end generated code: output=7f28fc0bf0259cba input=a9049054013a1b77]*/ |