aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-05-13 02:26:02 +0200
committerGitHub <noreply@github.com>2020-05-13 02:26:02 +0200
commitf9b3b582b86b9cce8d69ec7d03d716ec81c8264a (patch)
treeb64e8194712f6e43d8f17894bceaeb7e0ccbd6b8 /Python/marshal.c
parent9e2ca1742076169089b818d0883688a2ddd9964a (diff)
downloadcpython-f9b3b582b86b9cce8d69ec7d03d716ec81c8264a.tar.gz
cpython-f9b3b582b86b9cce8d69ec7d03d716ec81c8264a.zip
bpo-40609: Remove _Py_hashtable_t.key_size (GH-20060)
Rewrite _Py_hashtable_t type to always store the key as a "const void *" pointer. Add an explicit "key" member to _Py_hashtable_entry_t. Remove _Py_hashtable_t.key_size member. hash and compare functions drop their hash table parameter, and their 'key' parameter type becomes "const void *".
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index d2bff524f30..1e901ae7c31 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -549,7 +549,7 @@ static int
w_init_refs(WFILE *wf, int version)
{
if (version >= 3) {
- wf->hashtable = _Py_hashtable_new(sizeof(PyObject *), sizeof(int),
+ wf->hashtable = _Py_hashtable_new(sizeof(int),
_Py_hashtable_hash_ptr,
_Py_hashtable_compare_direct);
if (wf->hashtable == NULL) {
@@ -564,9 +564,7 @@ static int
w_decref_entry(_Py_hashtable_t *ht, _Py_hashtable_entry_t *entry,
void *Py_UNUSED(data))
{
- PyObject *entry_key;
-
- _Py_HASHTABLE_ENTRY_READ_KEY(ht, entry, entry_key);
+ PyObject *entry_key = (PyObject *)entry->key;
Py_XDECREF(entry_key);
return 0;
}