diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-18 20:52:22 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-18 20:52:22 (GMT) |
commit | 51b846c47a9b1db927939ccfb037a5a0ff6ff99c (patch) | |
tree | ffeaefd9c170340c909063d8a17d803ec782bb8d /Python | |
parent | 5decb844545cfb17fdc3d914cf51ab1c2568a375 (diff) | |
download | cpython-51b846c47a9b1db927939ccfb037a5a0ff6ff99c.zip cpython-51b846c47a9b1db927939ccfb037a5a0ff6ff99c.tar.gz cpython-51b846c47a9b1db927939ccfb037a5a0ff6ff99c.tar.bz2 |
_tracemalloc: add domain to trace keys
* hashtable.h: key has now a variable size
* _tracemalloc uses (pointer: void*, domain: unsigned int) as key for traces
Diffstat (limited to 'Python')
-rw-r--r-- | Python/marshal.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Python/marshal.c b/Python/marshal.c index 7a4b9d2..64084f4 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -263,7 +263,7 @@ w_ref(PyObject *v, char *flag, WFILE *p) if (Py_REFCNT(v) == 1) return 0; - entry = _Py_hashtable_get_entry(p->hashtable, v); + entry = _Py_HASHTABLE_GET_ENTRY(p->hashtable, v); if (entry != NULL) { /* write the reference index to the stream */ _Py_HASHTABLE_ENTRY_READ_DATA(p->hashtable, &w, sizeof(w), entry); @@ -571,7 +571,8 @@ static int w_init_refs(WFILE *wf, int version) { if (version >= 3) { - wf->hashtable = _Py_hashtable_new(sizeof(int), _Py_hashtable_hash_ptr, + wf->hashtable = _Py_hashtable_new(sizeof(void *), sizeof(int), + _Py_hashtable_hash_ptr, _Py_hashtable_compare_direct); if (wf->hashtable == NULL) { PyErr_NoMemory(); @@ -582,9 +583,11 @@ w_init_refs(WFILE *wf, int version) } static int -w_decref_entry(_Py_hashtable_entry_t *entry, void *Py_UNUSED(data)) +w_decref_entry(_Py_hashtable_t *ht, _Py_hashtable_entry_t *entry, void *Py_UNUSED(data)) { - Py_XDECREF(entry->key); + void *entry_key = *(void **)_Py_HASHTABLE_ENTRY_KEY(entry); + assert(ht->key_size == sizeof(entry_key)); + Py_XDECREF(entry_key); return 0; } |