/src/cpython/Objects/clinic/namespaceobject.c.h
Line | Count | Source |
1 | | /*[clinic input] |
2 | | preserve |
3 | | [clinic start generated code]*/ |
4 | | |
5 | | #include "pycore_modsupport.h" // _PyArg_NoPositional() |
6 | | |
7 | | PyDoc_STRVAR(namespace___replace____doc__, |
8 | | "__replace__($self, /, **changes)\n" |
9 | | "--\n" |
10 | | "\n" |
11 | | "Return a copy with the specified attributes replaced."); |
12 | | |
13 | | #define NAMESPACE___REPLACE___METHODDEF \ |
14 | | {"__replace__", _PyCFunction_CAST(namespace___replace__), METH_VARARGS|METH_KEYWORDS, namespace___replace____doc__}, |
15 | | |
16 | | static PyObject * |
17 | | namespace___replace___impl(_PyNamespaceObject *self, PyObject *changes); |
18 | | |
19 | | static PyObject * |
20 | | namespace___replace__(PyObject *self, PyObject *args, PyObject *kwargs) |
21 | 0 | { |
22 | 0 | PyObject *return_value = NULL; |
23 | 0 | PyObject *changes = NULL; |
24 | |
|
25 | 0 | if (!_PyArg_NoPositional("__replace__", args)) { |
26 | 0 | goto exit; |
27 | 0 | } |
28 | 0 | if (kwargs == NULL) { |
29 | 0 | changes = PyDict_New(); |
30 | 0 | if (changes == NULL) { |
31 | 0 | goto exit; |
32 | 0 | } |
33 | 0 | } |
34 | 0 | else { |
35 | 0 | changes = Py_NewRef(kwargs); |
36 | 0 | } |
37 | 0 | return_value = namespace___replace___impl((_PyNamespaceObject *)self, changes); |
38 | |
|
39 | 0 | exit: |
40 | | /* Cleanup for changes */ |
41 | 0 | Py_XDECREF(changes); |
42 | |
|
43 | 0 | return return_value; |
44 | 0 | } |
45 | | /*[clinic end generated code: output=67b5fcb6a6aee559 input=a9049054013a1b77]*/ |