Coverage Report

Created: 2022-07-08 09:39

/home/mdboom/Work/builds/cpython/Include/internal/pycore_typeobject.h
Line
Count
Source
1
#ifndef Py_INTERNAL_TYPEOBJECT_H
2
#define Py_INTERNAL_TYPEOBJECT_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
/* runtime lifecycle */
13
14
extern PyStatus _PyTypes_InitState(PyInterpreterState *);
15
extern PyStatus _PyTypes_InitTypes(PyInterpreterState *);
16
extern void _PyTypes_FiniTypes(PyInterpreterState *);
17
extern void _PyTypes_Fini(PyInterpreterState *);
18
19
20
/* other API */
21
22
// Type attribute lookup cache: speed up attribute and method lookups,
23
// see _PyType_Lookup().
24
struct type_cache_entry {
25
    unsigned int version;  // initialized from type->tp_version_tag
26
    PyObject *name;        // reference to exactly a str or None
27
    PyObject *value;       // borrowed reference or NULL
28
};
29
30
#define MCACHE_SIZE_EXP 12
31
#define MCACHE_STATS 0
32
33
struct type_cache {
34
    struct type_cache_entry hashtable[1 << MCACHE_SIZE_EXP];
35
#if MCACHE_STATS
36
    size_t hits;
37
    size_t misses;
38
    size_t collisions;
39
#endif
40
};
41
42
extern PyStatus _PyTypes_InitSlotDefs(void);
43
44
extern void _PyStaticType_Dealloc(PyTypeObject *type);
45
46
47
#ifdef __cplusplus
48
}
49
#endif
50
#endif /* !Py_INTERNAL_TYPEOBJECT_H */