annotate Modules/hashtable.h @ 87690:66c1c9f32567 default tip

Add use_weakref option to functools.lru_cache The use_weakref option makes lru_cache create weak references to the function arguments when creating the cache key, which prevents them from staying in the memory forever even after all other references to them are gone. This is a proof of concept for http://bugs.python.org/issue19859
author Radomir Dopieralski <devel@sheep.art.pl>
date Tue, 03 Dec 2013 16:02:48 +0100
parents 6e2089dbc5ad
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
87401
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
1 #ifndef Py_HASHTABLE_H
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
2 #define Py_HASHTABLE_H
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
3
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
4 /* The whole API is private */
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
5 #ifndef Py_LIMITED_API
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
6
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
7 typedef struct _Py_slist_item_s {
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
8 struct _Py_slist_item_s *next;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
9 } _Py_slist_item_t;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
10
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
11 typedef struct {
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
12 _Py_slist_item_t *head;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
13 } _Py_slist_t;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
14
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
15 #define _Py_SLIST_ITEM_NEXT(ITEM) (((_Py_slist_item_t *)ITEM)->next)
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
16
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
17 #define _Py_SLIST_HEAD(SLIST) (((_Py_slist_t *)SLIST)->head)
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
18
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
19 typedef struct {
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
20 /* used by _Py_hashtable_t.buckets to link entries */
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
21 _Py_slist_item_t _Py_slist_item;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
22
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
23 const void *key;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
24 Py_uhash_t key_hash;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
25
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
26 /* data follows */
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
27 } _Py_hashtable_entry_t;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
28
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
29 #define _PY_HASHTABLE_ENTRY_DATA(ENTRY) \
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
30 ((char *)(ENTRY) + sizeof(_Py_hashtable_entry_t))
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
31
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
32 #define _Py_HASHTABLE_ENTRY_DATA_AS_VOID_P(ENTRY) \
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
33 (*(void **)_PY_HASHTABLE_ENTRY_DATA(ENTRY))
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
34
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
35 #define _Py_HASHTABLE_ENTRY_READ_DATA(TABLE, DATA, DATA_SIZE, ENTRY) \
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
36 do { \
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
37 assert((DATA_SIZE) == (TABLE)->data_size); \
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
38 memcpy(DATA, _PY_HASHTABLE_ENTRY_DATA(ENTRY), DATA_SIZE); \
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
39 } while (0)
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
40
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
41 typedef Py_uhash_t (*_Py_hashtable_hash_func) (const void *key);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
42 typedef int (*_Py_hashtable_compare_func) (const void *key, const _Py_hashtable_entry_t *he);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
43 typedef void* (*_Py_hashtable_copy_data_func)(void *data);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
44 typedef void (*_Py_hashtable_free_data_func)(void *data);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
45 typedef size_t (*_Py_hashtable_get_data_size_func)(void *data);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
46
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
47 typedef struct {
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
48 /* allocate a memory block */
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
49 void* (*malloc) (size_t size);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
50
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
51 /* release a memory block */
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
52 void (*free) (void *ptr);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
53 } _Py_hashtable_allocator_t;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
54
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
55 typedef struct {
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
56 size_t num_buckets;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
57 size_t entries; /* Total number of entries in the table. */
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
58 _Py_slist_t *buckets;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
59 size_t data_size;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
60
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
61 _Py_hashtable_hash_func hash_func;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
62 _Py_hashtable_compare_func compare_func;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
63 _Py_hashtable_copy_data_func copy_data_func;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
64 _Py_hashtable_free_data_func free_data_func;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
65 _Py_hashtable_get_data_size_func get_data_size_func;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
66 _Py_hashtable_allocator_t alloc;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
67 } _Py_hashtable_t;
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
68
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
69 /* hash and compare functions for integers and pointers */
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
70 PyAPI_FUNC(Py_uhash_t) _Py_hashtable_hash_ptr(const void *key);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
71 PyAPI_FUNC(Py_uhash_t) _Py_hashtable_hash_int(const void *key);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
72 PyAPI_FUNC(int) _Py_hashtable_compare_direct(const void *key, const _Py_hashtable_entry_t *entry);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
73
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
74 PyAPI_FUNC(_Py_hashtable_t *) _Py_hashtable_new(
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
75 size_t data_size,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
76 _Py_hashtable_hash_func hash_func,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
77 _Py_hashtable_compare_func compare_func);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
78 PyAPI_FUNC(_Py_hashtable_t *) _Py_hashtable_new_full(
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
79 size_t data_size,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
80 size_t init_size,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
81 _Py_hashtable_hash_func hash_func,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
82 _Py_hashtable_compare_func compare_func,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
83 _Py_hashtable_copy_data_func copy_data_func,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
84 _Py_hashtable_free_data_func free_data_func,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
85 _Py_hashtable_get_data_size_func get_data_size_func,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
86 _Py_hashtable_allocator_t *allocator);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
87 PyAPI_FUNC(_Py_hashtable_t *) _Py_hashtable_copy(_Py_hashtable_t *src);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
88 PyAPI_FUNC(void) _Py_hashtable_clear(_Py_hashtable_t *ht);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
89 PyAPI_FUNC(void) _Py_hashtable_destroy(_Py_hashtable_t *ht);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
90
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
91 typedef int (*_Py_hashtable_foreach_func) (_Py_hashtable_entry_t *entry, void *arg);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
92
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
93 PyAPI_FUNC(int) _Py_hashtable_foreach(
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
94 _Py_hashtable_t *ht,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
95 _Py_hashtable_foreach_func func, void *arg);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
96 PyAPI_FUNC(size_t) _Py_hashtable_size(_Py_hashtable_t *ht);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
97
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
98 PyAPI_FUNC(_Py_hashtable_entry_t*) _Py_hashtable_get_entry(
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
99 _Py_hashtable_t *ht,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
100 const void *key);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
101 PyAPI_FUNC(int) _Py_hashtable_set(
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
102 _Py_hashtable_t *ht,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
103 const void *key,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
104 void *data,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
105 size_t data_size);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
106 PyAPI_FUNC(int) _Py_hashtable_get(
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
107 _Py_hashtable_t *ht,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
108 const void *key,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
109 void *data,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
110 size_t data_size);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
111 PyAPI_FUNC(int) _Py_hashtable_pop(
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
112 _Py_hashtable_t *ht,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
113 const void *key,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
114 void *data,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
115 size_t data_size);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
116 PyAPI_FUNC(void) _Py_hashtable_delete(
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
117 _Py_hashtable_t *ht,
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
118 const void *key);
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
119
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
120 #define _Py_HASHTABLE_SET(TABLE, KEY, DATA) \
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
121 _Py_hashtable_set(TABLE, KEY, &(DATA), sizeof(DATA))
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
122
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
123 #define _Py_HASHTABLE_GET(TABLE, KEY, DATA) \
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
124 _Py_hashtable_get(TABLE, KEY, &(DATA), sizeof(DATA))
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
125
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
126 #endif /* Py_LIMITED_API */
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
127
6e2089dbc5ad Issue #18874: Implement the PEP 454 (tracemalloc)
Victor Stinner <victor.stinner@gmail.com>
parents:
diff changeset
128 #endif