2022-11-16 13:37:29 -04:00
|
|
|
#ifndef Py_INTERNAL_DICT_STATE_H
|
|
|
|
#define Py_INTERNAL_DICT_STATE_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef Py_BUILD_CORE
|
|
|
|
# error "this header requires Py_BUILD_CORE define"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef WITH_FREELISTS
|
|
|
|
// without freelists
|
|
|
|
# define PyDict_MAXFREELIST 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PyDict_MAXFREELIST
|
|
|
|
# define PyDict_MAXFREELIST 80
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define DICT_MAX_WATCHERS 8
|
|
|
|
|
|
|
|
struct _Py_dict_state {
|
2023-03-09 11:16:30 -04:00
|
|
|
/*Global counter used to set ma_version_tag field of dictionary.
|
|
|
|
* It is incremented each time that a dictionary is created and each
|
|
|
|
* time that a dictionary is modified. */
|
|
|
|
uint64_t global_version;
|
2023-03-08 21:04:16 -04:00
|
|
|
uint32_t next_keys_version;
|
|
|
|
|
2022-11-16 13:37:29 -04:00
|
|
|
#if PyDict_MAXFREELIST > 0
|
|
|
|
/* Dictionary reuse scheme to save calls to malloc and free */
|
|
|
|
PyDictObject *free_list[PyDict_MAXFREELIST];
|
|
|
|
PyDictKeysObject *keys_free_list[PyDict_MAXFREELIST];
|
|
|
|
int numfree;
|
|
|
|
int keys_numfree;
|
|
|
|
#endif
|
2023-03-08 21:04:16 -04:00
|
|
|
|
2022-11-16 13:37:29 -04:00
|
|
|
PyDict_WatchCallback watchers[DICT_MAX_WATCHERS];
|
|
|
|
};
|
|
|
|
|
2023-05-10 10:28:40 -03:00
|
|
|
#define _dict_state_INIT \
|
|
|
|
{ \
|
|
|
|
.next_keys_version = 2, \
|
|
|
|
}
|
|
|
|
|
2022-11-16 13:37:29 -04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_INTERNAL_DICT_STATE_H */
|