mirror of
https://github.com/python/cpython.git
synced 2025-07-07 11:25:30 +00:00
gh-111178: Fix function signatures for multiple tests (#131496)
This commit is contained in:
parent
486d537065
commit
34c1ea3109
15 changed files with 112 additions and 69 deletions
|
@ -4995,8 +4995,9 @@ malloc_error:
|
|||
}
|
||||
|
||||
static Py_hash_t
|
||||
dec_hash(PyDecObject *self)
|
||||
dec_hash(PyObject *op)
|
||||
{
|
||||
PyDecObject *self = _PyDecObject_CAST(op);
|
||||
if (self->hash == -1) {
|
||||
self->hash = _dec_hash(self);
|
||||
}
|
||||
|
|
|
@ -451,8 +451,9 @@ PyDoc_STRVAR(SSLEOFError_doc,
|
|||
"SSL/TLS connection terminated abruptly.");
|
||||
|
||||
static PyObject *
|
||||
SSLError_str(PyOSErrorObject *self)
|
||||
SSLError_str(PyObject *op)
|
||||
{
|
||||
PyOSErrorObject *self = (PyOSErrorObject*)op;
|
||||
if (self->strerror != NULL && PyUnicode_Check(self->strerror)) {
|
||||
return Py_NewRef(self->strerror);
|
||||
}
|
||||
|
|
|
@ -1778,8 +1778,9 @@ err_nomem:
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
ndarray_subscript(NDArrayObject *self, PyObject *key)
|
||||
ndarray_subscript(PyObject *op, PyObject *key)
|
||||
{
|
||||
NDArrayObject *self = (NDArrayObject*)op;
|
||||
NDArrayObject *nd;
|
||||
ndbuf_t *ndbuf;
|
||||
Py_buffer *base = &self->head->base;
|
||||
|
@ -1862,8 +1863,9 @@ err_occurred:
|
|||
|
||||
|
||||
static int
|
||||
ndarray_ass_subscript(NDArrayObject *self, PyObject *key, PyObject *value)
|
||||
ndarray_ass_subscript(PyObject *op, PyObject *key, PyObject *value)
|
||||
{
|
||||
NDArrayObject *self = (NDArrayObject*)op;
|
||||
NDArrayObject *nd;
|
||||
Py_buffer *dest = &self->head->base;
|
||||
Py_buffer src;
|
||||
|
@ -1907,7 +1909,7 @@ ndarray_ass_subscript(NDArrayObject *self, PyObject *key, PyObject *value)
|
|||
if (PyObject_GetBuffer(value, &src, PyBUF_FULL_RO) == -1)
|
||||
return -1;
|
||||
|
||||
nd = (NDArrayObject *)ndarray_subscript(self, key);
|
||||
nd = (NDArrayObject *)ndarray_subscript((PyObject*)self, key);
|
||||
if (nd != NULL) {
|
||||
dest = &nd->head->base;
|
||||
ret = copy_buffer(dest, &src);
|
||||
|
@ -1959,8 +1961,8 @@ error:
|
|||
|
||||
static PyMappingMethods ndarray_as_mapping = {
|
||||
NULL, /* mp_length */
|
||||
(binaryfunc)ndarray_subscript, /* mp_subscript */
|
||||
(objobjargproc)ndarray_ass_subscript /* mp_ass_subscript */
|
||||
ndarray_subscript, /* mp_subscript */
|
||||
ndarray_ass_subscript /* mp_ass_subscript */
|
||||
};
|
||||
|
||||
static PySequenceMethods ndarray_as_sequence = {
|
||||
|
|
|
@ -2931,20 +2931,22 @@ typedef struct {
|
|||
} PyGenericAliasObject;
|
||||
|
||||
static void
|
||||
generic_alias_dealloc(PyGenericAliasObject *self)
|
||||
generic_alias_dealloc(PyObject *op)
|
||||
{
|
||||
PyGenericAliasObject *self = (PyGenericAliasObject*)op;
|
||||
Py_CLEAR(self->item);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
generic_alias_mro_entries(PyGenericAliasObject *self, PyObject *bases)
|
||||
generic_alias_mro_entries(PyObject *op, PyObject *bases)
|
||||
{
|
||||
PyGenericAliasObject *self = (PyGenericAliasObject*)op;
|
||||
return PyTuple_Pack(1, self->item);
|
||||
}
|
||||
|
||||
static PyMethodDef generic_alias_methods[] = {
|
||||
{"__mro_entries__", _PyCFunction_CAST(generic_alias_mro_entries), METH_O, NULL},
|
||||
{"__mro_entries__", generic_alias_mro_entries, METH_O, NULL},
|
||||
{NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
@ -2953,7 +2955,7 @@ static PyTypeObject GenericAlias_Type = {
|
|||
"GenericAlias",
|
||||
sizeof(PyGenericAliasObject),
|
||||
0,
|
||||
.tp_dealloc = (destructor)generic_alias_dealloc,
|
||||
.tp_dealloc = generic_alias_dealloc,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
.tp_methods = generic_alias_methods,
|
||||
};
|
||||
|
@ -3084,8 +3086,9 @@ ContainerNoGC_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
}
|
||||
|
||||
static void
|
||||
ContainerNoGC_dealloc(ContainerNoGCobject *self)
|
||||
ContainerNoGC_dealloc(PyObject *op)
|
||||
{
|
||||
ContainerNoGCobject *self = (ContainerNoGCobject*)op;
|
||||
Py_DECREF(self->value);
|
||||
Py_TYPE(self)->tp_free((PyObject *)self);
|
||||
}
|
||||
|
@ -3100,7 +3103,7 @@ static PyTypeObject ContainerNoGC_type = {
|
|||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"_testcapi.ContainerNoGC",
|
||||
sizeof(ContainerNoGCobject),
|
||||
.tp_dealloc = (destructor)ContainerNoGC_dealloc,
|
||||
.tp_dealloc = ContainerNoGC_dealloc,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
.tp_members = ContainerNoGC_members,
|
||||
.tp_new = ContainerNoGC_new,
|
||||
|
|
|
@ -30,7 +30,7 @@ LimitedVectorCallClass_vectorcall(PyObject *callable,
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
LimitedVectorCallClass_new(PyTypeObject *tp, PyTypeObject *a, PyTypeObject *kw)
|
||||
LimitedVectorCallClass_new(PyTypeObject *tp, PyObject *a, PyObject *kw)
|
||||
{
|
||||
PyObject *self = ((allocfunc)PyType_GetSlot(tp, Py_tp_alloc))(tp, 0);
|
||||
if (!self) {
|
||||
|
@ -182,7 +182,7 @@ typedef struct {
|
|||
} LimitedRelativeVectorCallStruct;
|
||||
|
||||
static PyObject *
|
||||
LimitedRelativeVectorCallClass_new(PyTypeObject *tp, PyTypeObject *a, PyTypeObject *kw)
|
||||
LimitedRelativeVectorCallClass_new(PyTypeObject *tp, PyObject *a, PyObject *kw)
|
||||
{
|
||||
PyObject *self = ((allocfunc)PyType_GetSlot(tp, Py_tp_alloc))(tp, 0);
|
||||
if (!self) {
|
||||
|
|
|
@ -100,7 +100,7 @@ Xxo_getattro(PyObject *op, PyObject *name)
|
|||
}
|
||||
|
||||
static int
|
||||
Xxo_setattr(PyObject *op, const char *name, PyObject *v)
|
||||
Xxo_setattr(PyObject *op, char *name, PyObject *v)
|
||||
{
|
||||
XxoObject *self = XxoObject_CAST(op);
|
||||
if (self->x_attr == NULL) {
|
||||
|
|
|
@ -1363,8 +1363,9 @@ class zlib.ZlibDecompressor "ZlibDecompressor *" "&ZlibDecompressorType"
|
|||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=0658178ab94645df]*/
|
||||
|
||||
static void
|
||||
ZlibDecompressor_dealloc(ZlibDecompressor *self)
|
||||
ZlibDecompressor_dealloc(PyObject *op)
|
||||
{
|
||||
ZlibDecompressor *self = (ZlibDecompressor*)op;
|
||||
PyObject *type = (PyObject *)Py_TYPE(self);
|
||||
PyThread_free_lock(self->lock);
|
||||
if (self->is_initialised) {
|
||||
|
|
|
@ -1534,8 +1534,9 @@ async_gen_anext(PyObject *self)
|
|||
|
||||
|
||||
static PyObject *
|
||||
async_gen_asend(PyAsyncGenObject *o, PyObject *arg)
|
||||
async_gen_asend(PyObject *op, PyObject *arg)
|
||||
{
|
||||
PyAsyncGenObject *o = (PyAsyncGenObject*)op;
|
||||
if (async_gen_init_hooks(o)) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1544,8 +1545,9 @@ async_gen_asend(PyAsyncGenObject *o, PyObject *arg)
|
|||
|
||||
|
||||
static PyObject *
|
||||
async_gen_aclose(PyAsyncGenObject *o, PyObject *arg)
|
||||
async_gen_aclose(PyObject *op, PyObject *arg)
|
||||
{
|
||||
PyAsyncGenObject *o = (PyAsyncGenObject*)op;
|
||||
if (async_gen_init_hooks(o)) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1553,8 +1555,9 @@ async_gen_aclose(PyAsyncGenObject *o, PyObject *arg)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
async_gen_athrow(PyAsyncGenObject *o, PyObject *args)
|
||||
async_gen_athrow(PyObject *op, PyObject *args)
|
||||
{
|
||||
PyAsyncGenObject *o = (PyAsyncGenObject*)op;
|
||||
if (PyTuple_GET_SIZE(args) > 1) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"the (type, exc, tb) signature of athrow() is deprecated, "
|
||||
|
@ -1625,9 +1628,9 @@ the (type, val, tb) signature is deprecated, \n\
|
|||
and may be removed in a future version of Python.");
|
||||
|
||||
static PyMethodDef async_gen_methods[] = {
|
||||
{"asend", (PyCFunction)async_gen_asend, METH_O, async_asend_doc},
|
||||
{"athrow",(PyCFunction)async_gen_athrow, METH_VARARGS, async_athrow_doc},
|
||||
{"aclose", (PyCFunction)async_gen_aclose, METH_NOARGS, async_aclose_doc},
|
||||
{"asend", async_gen_asend, METH_O, async_asend_doc},
|
||||
{"athrow", async_gen_athrow, METH_VARARGS, async_athrow_doc},
|
||||
{"aclose", async_gen_aclose, METH_NOARGS, async_aclose_doc},
|
||||
{"__sizeof__", gen_sizeof, METH_NOARGS, sizeof__doc__},
|
||||
{"__class_getitem__", Py_GenericAlias,
|
||||
METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
|
||||
|
@ -2324,8 +2327,9 @@ async_gen_athrow_close(PyObject *self, PyObject *args)
|
|||
|
||||
|
||||
static void
|
||||
async_gen_athrow_finalize(PyAsyncGenAThrow *o)
|
||||
async_gen_athrow_finalize(PyObject *op)
|
||||
{
|
||||
PyAsyncGenAThrow *o = (PyAsyncGenAThrow*)op;
|
||||
if (o->agt_state == AWAITABLE_STATE_INIT) {
|
||||
PyObject *method = o->agt_args ? &_Py_ID(athrow) : &_Py_ID(aclose);
|
||||
_PyErr_WarnUnawaitedAgenMethod(o->agt_gen, method);
|
||||
|
@ -2389,7 +2393,7 @@ PyTypeObject _PyAsyncGenAThrow_Type = {
|
|||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
0, /* tp_new */
|
||||
.tp_finalize = (destructor)async_gen_athrow_finalize,
|
||||
.tp_finalize = async_gen_athrow_finalize,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -6474,6 +6474,12 @@ long_long_meth(PyObject *self, PyObject *Py_UNUSED(ignored))
|
|||
return long_long(self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
long_long_getter(PyObject *self, void *Py_UNUSED(ignored))
|
||||
{
|
||||
return long_long(self);
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
int.is_integer
|
||||
|
||||
|
@ -6534,7 +6540,7 @@ static PyMethodDef long_methods[] = {
|
|||
|
||||
static PyGetSetDef long_getset[] = {
|
||||
{"real",
|
||||
(getter)long_long_meth, (setter)NULL,
|
||||
long_long_getter, (setter)NULL,
|
||||
"the real part of a complex number",
|
||||
NULL},
|
||||
{"imag",
|
||||
|
@ -6542,7 +6548,7 @@ static PyGetSetDef long_getset[] = {
|
|||
"the imaginary part of a complex number",
|
||||
NULL},
|
||||
{"numerator",
|
||||
(getter)long_long_meth, (setter)NULL,
|
||||
long_long_getter, (setter)NULL,
|
||||
"the numerator of a rational number in lowest terms",
|
||||
NULL},
|
||||
{"denominator",
|
||||
|
|
|
@ -91,22 +91,25 @@ picklebuf_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
|
||||
static int
|
||||
picklebuf_traverse(PyPickleBufferObject *self, visitproc visit, void *arg)
|
||||
picklebuf_traverse(PyObject *op, visitproc visit, void *arg)
|
||||
{
|
||||
PyPickleBufferObject *self = (PyPickleBufferObject*)op;
|
||||
Py_VISIT(self->view.obj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
picklebuf_clear(PyPickleBufferObject *self)
|
||||
picklebuf_clear(PyObject *op)
|
||||
{
|
||||
PyPickleBufferObject *self = (PyPickleBufferObject*)op;
|
||||
PyBuffer_Release(&self->view);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
picklebuf_dealloc(PyPickleBufferObject *self)
|
||||
picklebuf_dealloc(PyObject *op)
|
||||
{
|
||||
PyPickleBufferObject *self = (PyPickleBufferObject*)op;
|
||||
PyObject_GC_UnTrack(self);
|
||||
if (self->weakreflist != NULL)
|
||||
PyObject_ClearWeakRefs((PyObject *) self);
|
||||
|
@ -117,8 +120,9 @@ picklebuf_dealloc(PyPickleBufferObject *self)
|
|||
/* Buffer API */
|
||||
|
||||
static int
|
||||
picklebuf_getbuf(PyPickleBufferObject *self, Py_buffer *view, int flags)
|
||||
picklebuf_getbuf(PyObject *op, Py_buffer *view, int flags)
|
||||
{
|
||||
PyPickleBufferObject *self = (PyPickleBufferObject*)op;
|
||||
if (self->view.obj == NULL) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"operation forbidden on released PickleBuffer object");
|
||||
|
@ -128,7 +132,7 @@ picklebuf_getbuf(PyPickleBufferObject *self, Py_buffer *view, int flags)
|
|||
}
|
||||
|
||||
static void
|
||||
picklebuf_releasebuf(PyPickleBufferObject *self, Py_buffer *view)
|
||||
picklebuf_releasebuf(PyObject *self, Py_buffer *view)
|
||||
{
|
||||
/* Since our bf_getbuffer redirects to the original object, this
|
||||
* implementation is never called. It only exists to signal that
|
||||
|
@ -138,15 +142,16 @@ picklebuf_releasebuf(PyPickleBufferObject *self, Py_buffer *view)
|
|||
}
|
||||
|
||||
static PyBufferProcs picklebuf_as_buffer = {
|
||||
.bf_getbuffer = (getbufferproc) picklebuf_getbuf,
|
||||
.bf_releasebuffer = (releasebufferproc) picklebuf_releasebuf,
|
||||
.bf_getbuffer = picklebuf_getbuf,
|
||||
.bf_releasebuffer = picklebuf_releasebuf,
|
||||
};
|
||||
|
||||
/* Methods */
|
||||
|
||||
static PyObject *
|
||||
picklebuf_raw(PyPickleBufferObject *self, PyObject *Py_UNUSED(ignored))
|
||||
picklebuf_raw(PyObject *op, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
PyPickleBufferObject *self = (PyPickleBufferObject*)op;
|
||||
if (self->view.obj == NULL) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"operation forbidden on released PickleBuffer object");
|
||||
|
@ -185,8 +190,9 @@ Return a memoryview of the raw memory underlying this buffer.\n\
|
|||
Will raise BufferError is the buffer isn't contiguous.");
|
||||
|
||||
static PyObject *
|
||||
picklebuf_release(PyPickleBufferObject *self, PyObject *Py_UNUSED(ignored))
|
||||
picklebuf_release(PyObject *op, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
PyPickleBufferObject *self = (PyPickleBufferObject*)op;
|
||||
PyBuffer_Release(&self->view);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
@ -197,8 +203,8 @@ PyDoc_STRVAR(picklebuf_release_doc,
|
|||
Release the underlying buffer exposed by the PickleBuffer object.");
|
||||
|
||||
static PyMethodDef picklebuf_methods[] = {
|
||||
{"raw", (PyCFunction) picklebuf_raw, METH_NOARGS, picklebuf_raw_doc},
|
||||
{"release", (PyCFunction) picklebuf_release, METH_NOARGS, picklebuf_release_doc},
|
||||
{"raw", picklebuf_raw, METH_NOARGS, picklebuf_raw_doc},
|
||||
{"release", picklebuf_release, METH_NOARGS, picklebuf_release_doc},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -209,9 +215,9 @@ PyTypeObject PyPickleBuffer_Type = {
|
|||
.tp_basicsize = sizeof(PyPickleBufferObject),
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
|
||||
.tp_new = picklebuf_new,
|
||||
.tp_dealloc = (destructor) picklebuf_dealloc,
|
||||
.tp_traverse = (traverseproc) picklebuf_traverse,
|
||||
.tp_clear = (inquiry) picklebuf_clear,
|
||||
.tp_dealloc = picklebuf_dealloc,
|
||||
.tp_traverse = picklebuf_traverse,
|
||||
.tp_clear = picklebuf_clear,
|
||||
.tp_weaklistoffset = offsetof(PyPickleBufferObject, weakreflist),
|
||||
.tp_as_buffer = &picklebuf_as_buffer,
|
||||
.tp_methods = picklebuf_methods,
|
||||
|
|
|
@ -816,8 +816,9 @@ setiter_traverse(PyObject *self, visitproc visit, void *arg)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
setiter_len(setiterobject *si, PyObject *Py_UNUSED(ignored))
|
||||
setiter_len(PyObject *op, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
setiterobject *si = (setiterobject*)op;
|
||||
Py_ssize_t len = 0;
|
||||
if (si->si_set != NULL && si->si_used == si->si_set->used)
|
||||
len = si->len;
|
||||
|
@ -827,8 +828,10 @@ setiter_len(setiterobject *si, PyObject *Py_UNUSED(ignored))
|
|||
PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");
|
||||
|
||||
static PyObject *
|
||||
setiter_reduce(setiterobject *si, PyObject *Py_UNUSED(ignored))
|
||||
setiter_reduce(PyObject *op, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
setiterobject *si = (setiterobject*)op;
|
||||
|
||||
/* copy the iterator state */
|
||||
setiterobject tmp = *si;
|
||||
Py_XINCREF(tmp.si_set);
|
||||
|
@ -845,8 +848,8 @@ setiter_reduce(setiterobject *si, PyObject *Py_UNUSED(ignored))
|
|||
PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
|
||||
|
||||
static PyMethodDef setiter_methods[] = {
|
||||
{"__length_hint__", (PyCFunction)setiter_len, METH_NOARGS, length_hint_doc},
|
||||
{"__reduce__", (PyCFunction)setiter_reduce, METH_NOARGS, reduce_doc},
|
||||
{"__length_hint__", setiter_len, METH_NOARGS, length_hint_doc},
|
||||
{"__reduce__", setiter_reduce, METH_NOARGS, reduce_doc},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
|
@ -522,8 +522,9 @@ _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
|
|||
/* Implementation of slice.indices. */
|
||||
|
||||
static PyObject*
|
||||
slice_indices(PySliceObject* self, PyObject* len)
|
||||
slice_indices(PyObject *op, PyObject* len)
|
||||
{
|
||||
PySliceObject *self = _PySlice_CAST(op);
|
||||
PyObject *start, *stop, *step;
|
||||
PyObject *length;
|
||||
int error;
|
||||
|
@ -557,18 +558,17 @@ S. Out of bounds indices are clipped in a manner consistent with the\n\
|
|||
handling of normal slices.");
|
||||
|
||||
static PyObject *
|
||||
slice_reduce(PySliceObject* self, PyObject *Py_UNUSED(ignored))
|
||||
slice_reduce(PyObject *op, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
PySliceObject *self = _PySlice_CAST(op);
|
||||
return Py_BuildValue("O(OOO)", Py_TYPE(self), self->start, self->stop, self->step);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
|
||||
|
||||
static PyMethodDef slice_methods[] = {
|
||||
{"indices", (PyCFunction)slice_indices,
|
||||
METH_O, slice_indices_doc},
|
||||
{"__reduce__", (PyCFunction)slice_reduce,
|
||||
METH_NOARGS, reduce_doc},
|
||||
{"indices", slice_indices, METH_O, slice_indices_doc},
|
||||
{"__reduce__", slice_reduce, METH_NOARGS, reduce_doc},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -977,8 +977,9 @@ typedef struct {
|
|||
} formatteriterobject;
|
||||
|
||||
static void
|
||||
formatteriter_dealloc(formatteriterobject *it)
|
||||
formatteriter_dealloc(PyObject *op)
|
||||
{
|
||||
formatteriterobject *it = (formatteriterobject*)op;
|
||||
Py_XDECREF(it->str);
|
||||
PyObject_Free(it);
|
||||
}
|
||||
|
@ -992,8 +993,9 @@ formatteriter_dealloc(formatteriterobject *it)
|
|||
conversion is either None, or the string after the '!'
|
||||
*/
|
||||
static PyObject *
|
||||
formatteriter_next(formatteriterobject *it)
|
||||
formatteriter_next(PyObject *op)
|
||||
{
|
||||
formatteriterobject *it = (formatteriterobject*)op;
|
||||
SubString literal;
|
||||
SubString field_name;
|
||||
SubString format_spec;
|
||||
|
@ -1066,7 +1068,7 @@ static PyTypeObject PyFormatterIter_Type = {
|
|||
sizeof(formatteriterobject), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
(destructor)formatteriter_dealloc, /* tp_dealloc */
|
||||
formatteriter_dealloc, /* tp_dealloc */
|
||||
0, /* tp_vectorcall_offset */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
|
@ -1088,7 +1090,7 @@ static PyTypeObject PyFormatterIter_Type = {
|
|||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
PyObject_SelfIter, /* tp_iter */
|
||||
(iternextfunc)formatteriter_next, /* tp_iternext */
|
||||
formatteriter_next, /* tp_iternext */
|
||||
formatteriter_methods, /* tp_methods */
|
||||
0,
|
||||
};
|
||||
|
@ -1136,8 +1138,9 @@ typedef struct {
|
|||
} fieldnameiterobject;
|
||||
|
||||
static void
|
||||
fieldnameiter_dealloc(fieldnameiterobject *it)
|
||||
fieldnameiter_dealloc(PyObject *op)
|
||||
{
|
||||
fieldnameiterobject *it = (fieldnameiterobject*)op;
|
||||
Py_XDECREF(it->str);
|
||||
PyObject_Free(it);
|
||||
}
|
||||
|
@ -1149,8 +1152,9 @@ fieldnameiter_dealloc(fieldnameiterobject *it)
|
|||
value is an integer or string
|
||||
*/
|
||||
static PyObject *
|
||||
fieldnameiter_next(fieldnameiterobject *it)
|
||||
fieldnameiter_next(PyObject *op)
|
||||
{
|
||||
fieldnameiterobject *it = (fieldnameiterobject*)op;
|
||||
int result;
|
||||
int is_attr;
|
||||
Py_ssize_t idx;
|
||||
|
@ -1198,7 +1202,7 @@ static PyTypeObject PyFieldNameIter_Type = {
|
|||
sizeof(fieldnameiterobject), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
(destructor)fieldnameiter_dealloc, /* tp_dealloc */
|
||||
fieldnameiter_dealloc, /* tp_dealloc */
|
||||
0, /* tp_vectorcall_offset */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
|
@ -1220,7 +1224,7 @@ static PyTypeObject PyFieldNameIter_Type = {
|
|||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
PyObject_SelfIter, /* tp_iter */
|
||||
(iternextfunc)fieldnameiter_next, /* tp_iternext */
|
||||
fieldnameiter_next, /* tp_iternext */
|
||||
fieldnameiter_methods, /* tp_methods */
|
||||
0};
|
||||
|
||||
|
|
|
@ -2433,14 +2433,15 @@ error:
|
|||
|
||||
|
||||
static int
|
||||
hamt_baseiter_tp_clear(PyHamtIterator *it)
|
||||
hamt_baseiter_tp_clear(PyObject *op)
|
||||
{
|
||||
PyHamtIterator *it = (PyHamtIterator*)op;
|
||||
Py_CLEAR(it->hi_obj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
hamt_baseiter_tp_dealloc(PyHamtIterator *it)
|
||||
hamt_baseiter_tp_dealloc(PyObject *it)
|
||||
{
|
||||
PyObject_GC_UnTrack(it);
|
||||
(void)hamt_baseiter_tp_clear(it);
|
||||
|
@ -2448,15 +2449,17 @@ hamt_baseiter_tp_dealloc(PyHamtIterator *it)
|
|||
}
|
||||
|
||||
static int
|
||||
hamt_baseiter_tp_traverse(PyHamtIterator *it, visitproc visit, void *arg)
|
||||
hamt_baseiter_tp_traverse(PyObject *op, visitproc visit, void *arg)
|
||||
{
|
||||
PyHamtIterator *it = (PyHamtIterator*)op;
|
||||
Py_VISIT(it->hi_obj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
hamt_baseiter_tp_iternext(PyHamtIterator *it)
|
||||
hamt_baseiter_tp_iternext(PyObject *op)
|
||||
{
|
||||
PyHamtIterator *it = (PyHamtIterator*)op;
|
||||
PyObject *key;
|
||||
PyObject *val;
|
||||
hamt_iter_t res = hamt_iterator_next(&it->hi_iter, &key, &val);
|
||||
|
@ -2477,13 +2480,14 @@ hamt_baseiter_tp_iternext(PyHamtIterator *it)
|
|||
}
|
||||
|
||||
static Py_ssize_t
|
||||
hamt_baseiter_tp_len(PyHamtIterator *it)
|
||||
hamt_baseiter_tp_len(PyObject *op)
|
||||
{
|
||||
PyHamtIterator *it = (PyHamtIterator*)op;
|
||||
return it->hi_obj->h_count;
|
||||
}
|
||||
|
||||
static PyMappingMethods PyHamtIterator_as_mapping = {
|
||||
(lenfunc)hamt_baseiter_tp_len,
|
||||
hamt_baseiter_tp_len,
|
||||
};
|
||||
|
||||
static PyObject *
|
||||
|
@ -2506,11 +2510,11 @@ hamt_baseiter_new(PyTypeObject *type, binaryfunc yield, PyHamtObject *o)
|
|||
.tp_basicsize = sizeof(PyHamtIterator), \
|
||||
.tp_itemsize = 0, \
|
||||
.tp_as_mapping = &PyHamtIterator_as_mapping, \
|
||||
.tp_dealloc = (destructor)hamt_baseiter_tp_dealloc, \
|
||||
.tp_dealloc = hamt_baseiter_tp_dealloc, \
|
||||
.tp_getattro = PyObject_GenericGetAttr, \
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, \
|
||||
.tp_traverse = (traverseproc)hamt_baseiter_tp_traverse, \
|
||||
.tp_clear = (inquiry)hamt_baseiter_tp_clear, \
|
||||
.tp_traverse = hamt_baseiter_tp_traverse, \
|
||||
.tp_clear = hamt_baseiter_tp_clear, \
|
||||
.tp_iter = PyObject_SelfIter, \
|
||||
.tp_iternext = (iternextfunc)hamt_baseiter_tp_iternext,
|
||||
|
||||
|
|
|
@ -378,13 +378,21 @@ tracemalloc_create_traces_table(void)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
tracemalloc_destroy_domain(void *value)
|
||||
{
|
||||
_Py_hashtable_t *ht = (_Py_hashtable_t*)value;
|
||||
_Py_hashtable_destroy(ht);
|
||||
}
|
||||
|
||||
|
||||
static _Py_hashtable_t*
|
||||
tracemalloc_create_domains_table(void)
|
||||
{
|
||||
return hashtable_new(hashtable_hash_uint,
|
||||
_Py_hashtable_compare_direct,
|
||||
NULL,
|
||||
(_Py_hashtable_destroy_func)_Py_hashtable_destroy);
|
||||
tracemalloc_destroy_domain);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue