* Build a dictionary from the keyword arguments, but replace out with the * normalized version (and always pass it even if it was passed by position). */
| 98 | * normalized version (and always pass it even if it was passed by position). |
| 99 | */ |
| 100 | static int |
| 101 | initialize_normal_kwds(PyObject *out_args, |
| 102 | PyObject *const *args, Py_ssize_t len_args, PyObject *kwnames, |
| 103 | PyObject *normal_kwds) |
| 104 | { |
| 105 | if (kwnames != NULL) { |
| 106 | for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(kwnames); i++) { |
| 107 | if (PyDict_SetItem(normal_kwds, |
| 108 | PyTuple_GET_ITEM(kwnames, i), args[i + len_args]) < 0) { |
| 109 | return -1; |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | static PyObject *out_str = NULL; |
| 114 | if (out_str == NULL) { |
| 115 | out_str = PyUnicode_InternFromString("out"); |
| 116 | if (out_str == NULL) { |
| 117 | return -1; |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | if (out_args != NULL) { |
| 122 | /* Replace `out` argument with the normalized version */ |
| 123 | int res = PyDict_SetItem(normal_kwds, out_str, out_args); |
| 124 | if (res < 0) { |
| 125 | return -1; |
| 126 | } |
| 127 | } |
| 128 | else { |
| 129 | /* Ensure that `out` is not present. */ |
| 130 | int res = PyDict_Contains(normal_kwds, out_str); |
| 131 | if (res < 0) { |
| 132 | return -1; |
| 133 | } |
| 134 | if (res) { |
| 135 | return PyDict_DelItem(normal_kwds, out_str); |
| 136 | } |
| 137 | } |
| 138 | return 0; |
| 139 | } |
| 140 | |
| 141 | /* |
| 142 | * ufunc() and ufunc.outer() accept 'sig' or 'signature'. We guarantee |
no outgoing calls
no test coverage detected