|
4 | 4 | #include "pycore_weakref.h" // FT_CLEAR_WEAKREFS() |
5 | 5 | #include <stddef.h> |
6 | 6 |
|
| 7 | +#include "clinic/picklebufobject.c.h" |
| 8 | + |
| 9 | +/*[clinic input] |
| 10 | +module pickle |
| 11 | +[clinic start generated code]*/ |
| 12 | +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6165c351cde067ba]*/ |
| 13 | + |
| 14 | +/*[clinic input] |
| 15 | +class pickle.PickleBuffer "PyPickleBufferObject *" "&PyPickleBuffer_Type" |
| 16 | +[clinic start generated code]*/ |
| 17 | +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=b334ecd891c9cbc2]*/ |
| 18 | + |
7 | 19 | typedef struct { |
8 | 20 | PyObject_HEAD |
9 | 21 | /* The view exported by the original object */ |
@@ -66,19 +78,20 @@ PyPickleBuffer_Release(PyObject *obj) |
66 | 78 | return 0; |
67 | 79 | } |
68 | 80 |
|
69 | | -static PyObject * |
70 | | -picklebuf_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
71 | | -{ |
72 | | - PyPickleBufferObject *self; |
73 | | - PyObject *base; |
74 | | - char *keywords[] = {"", NULL}; |
| 81 | +/*[clinic input] |
| 82 | +@vectorcall |
| 83 | +@classmethod |
| 84 | +pickle.PickleBuffer.__new__ as picklebuf_new |
75 | 85 |
|
76 | | - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:PickleBuffer", |
77 | | - keywords, &base)) { |
78 | | - return NULL; |
79 | | - } |
| 86 | + base: object |
| 87 | + / |
| 88 | +[clinic start generated code]*/ |
80 | 89 |
|
81 | | - self = (PyPickleBufferObject *) type->tp_alloc(type, 0); |
| 90 | +static PyObject * |
| 91 | +picklebuf_new_impl(PyTypeObject *type, PyObject *base) |
| 92 | +/*[clinic end generated code: output=b8269110aace6998 input=0f1cdf375a70e71d]*/ |
| 93 | +{ |
| 94 | + PyPickleBufferObject *self = (PyPickleBufferObject *) type->tp_alloc(type, 0); |
82 | 95 | if (self == NULL) { |
83 | 96 | return NULL; |
84 | 97 | } |
@@ -215,6 +228,7 @@ PyTypeObject PyPickleBuffer_Type = { |
215 | 228 | .tp_basicsize = sizeof(PyPickleBufferObject), |
216 | 229 | .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, |
217 | 230 | .tp_new = picklebuf_new, |
| 231 | + .tp_vectorcall = picklebuf_vectorcall, |
218 | 232 | .tp_dealloc = picklebuf_dealloc, |
219 | 233 | .tp_traverse = picklebuf_traverse, |
220 | 234 | .tp_clear = picklebuf_clear, |
|
0 commit comments