|
44 | 44 |
|
45 | 45 | /*[clinic input]
|
46 | 46 | class set "PySetObject *" "&PySet_Type"
|
| 47 | +class frozenset "PySetObject *" "&PyFrozenSet_Type" |
47 | 48 | [clinic start generated code]*/
|
48 |
| -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=abe13a1b24961902]*/ |
| 49 | +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=97ad1d3e9f117079]*/ |
49 | 50 |
|
50 | 51 | /* Object used as dummy key to fill deleted entries */
|
51 | 52 | static PyObject _dummy_struct;
|
@@ -1175,23 +1176,37 @@ set_swap_bodies(PySetObject *a, PySetObject *b)
|
1175 | 1176 | }
|
1176 | 1177 | }
|
1177 | 1178 |
|
| 1179 | +/*[clinic input] |
| 1180 | +@critical_section |
| 1181 | +set.copy |
| 1182 | +
|
| 1183 | +Return a shallow copy of a set. |
| 1184 | +[clinic start generated code]*/ |
| 1185 | + |
1178 | 1186 | static PyObject *
|
1179 |
| -set_copy(PySetObject *so, PyObject *Py_UNUSED(ignored)) |
| 1187 | +set_copy_impl(PySetObject *self) |
| 1188 | +/*[clinic end generated code: output=db3ef842e70a8bda input=23f7054e37bee78f]*/ |
1180 | 1189 | {
|
1181 |
| - return make_new_set_basetype(Py_TYPE(so), (PyObject *)so); |
| 1190 | + return make_new_set_basetype(Py_TYPE(self), (PyObject *)self); |
1182 | 1191 | }
|
1183 | 1192 |
|
| 1193 | +/*[clinic input] |
| 1194 | +@critical_section |
| 1195 | +frozenset.copy |
| 1196 | +
|
| 1197 | +Return a shallow copy of a set. |
| 1198 | +[clinic start generated code]*/ |
| 1199 | + |
1184 | 1200 | static PyObject *
|
1185 |
| -frozenset_copy(PySetObject *so, PyObject *Py_UNUSED(ignored)) |
| 1201 | +frozenset_copy_impl(PySetObject *self) |
| 1202 | +/*[clinic end generated code: output=3ff78c0546ebeafd input=7645c38bf258935c]*/ |
1186 | 1203 | {
|
1187 |
| - if (PyFrozenSet_CheckExact(so)) { |
1188 |
| - return Py_NewRef(so); |
| 1204 | + if (PyFrozenSet_CheckExact(self)) { |
| 1205 | + return Py_NewRef(self); |
1189 | 1206 | }
|
1190 |
| - return set_copy(so, NULL); |
| 1207 | + return set_copy(self, NULL); |
1191 | 1208 | }
|
1192 | 1209 |
|
1193 |
| -PyDoc_STRVAR(copy_doc, "Return a shallow copy of a set."); |
1194 |
| - |
1195 | 1210 | /*[clinic input]
|
1196 | 1211 | @critical_section
|
1197 | 1212 | set.clear
|
@@ -2303,8 +2318,7 @@ static PyMethodDef set_methods[] = {
|
2303 | 2318 | SET_ADD_METHODDEF
|
2304 | 2319 | SET_CLEAR_METHODDEF
|
2305 | 2320 | SET___CONTAINS___METHODDEF
|
2306 |
| - {"copy", (PyCFunction)set_copy, METH_NOARGS, |
2307 |
| - copy_doc}, |
| 2321 | + SET_COPY_METHODDEF |
2308 | 2322 | SET_DISCARD_METHODDEF
|
2309 | 2323 | {"difference", (PyCFunction)set_difference_multi, METH_VARARGS,
|
2310 | 2324 | difference_doc},
|
@@ -2428,8 +2442,7 @@ PyTypeObject PySet_Type = {
|
2428 | 2442 |
|
2429 | 2443 | static PyMethodDef frozenset_methods[] = {
|
2430 | 2444 | SET___CONTAINS___METHODDEF
|
2431 |
| - {"copy", (PyCFunction)frozenset_copy, METH_NOARGS, |
2432 |
| - copy_doc}, |
| 2445 | + FROZENSET_COPY_METHODDEF |
2433 | 2446 | {"difference", (PyCFunction)set_difference_multi, METH_VARARGS,
|
2434 | 2447 | difference_doc},
|
2435 | 2448 | {"intersection", (PyCFunction)set_intersection_multi, METH_VARARGS,
|
|
0 commit comments