Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
allendowney
GitHub Repository: allendowney/cpython
Path: blob/main/Include/internal/pycore_dict_state.h
12 views
1
#ifndef Py_INTERNAL_DICT_STATE_H
2
#define Py_INTERNAL_DICT_STATE_H
3
#ifdef __cplusplus
4
extern "C" {
5
#endif
6
7
#ifndef Py_BUILD_CORE
8
# error "this header requires Py_BUILD_CORE define"
9
#endif
10
11
12
#ifndef WITH_FREELISTS
13
// without freelists
14
# define PyDict_MAXFREELIST 0
15
#endif
16
17
#ifndef PyDict_MAXFREELIST
18
# define PyDict_MAXFREELIST 80
19
#endif
20
21
#define DICT_MAX_WATCHERS 8
22
23
struct _Py_dict_state {
24
/*Global counter used to set ma_version_tag field of dictionary.
25
* It is incremented each time that a dictionary is created and each
26
* time that a dictionary is modified. */
27
uint64_t global_version;
28
uint32_t next_keys_version;
29
30
#if PyDict_MAXFREELIST > 0
31
/* Dictionary reuse scheme to save calls to malloc and free */
32
PyDictObject *free_list[PyDict_MAXFREELIST];
33
PyDictKeysObject *keys_free_list[PyDict_MAXFREELIST];
34
int numfree;
35
int keys_numfree;
36
#endif
37
38
PyDict_WatchCallback watchers[DICT_MAX_WATCHERS];
39
};
40
41
#define _dict_state_INIT \
42
{ \
43
.next_keys_version = 2, \
44
}
45
46
47
#ifdef __cplusplus
48
}
49
#endif
50
#endif /* !Py_INTERNAL_DICT_STATE_H */
51
52