aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/hamt.c22
-rw-r--r--Python/tracemalloc.c10
2 files changed, 22 insertions, 10 deletions
diff --git a/Python/hamt.c b/Python/hamt.c
index ed43a0449d7..42a0baffd9d 100644
--- a/Python/hamt.c
+++ b/Python/hamt.c
@@ -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,
diff --git a/Python/tracemalloc.c b/Python/tracemalloc.c
index 82e9c6f95e9..2bdb6c36bdb 100644
--- a/Python/tracemalloc.c
+++ b/Python/tracemalloc.c
@@ -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);
}