summaryrefslogtreecommitdiff
path: root/Include/internal/pycore_import.h
blob: 9036dff6725330a037b625a273df4bfb8053616c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef Py_LIMITED_API
#ifndef Py_INTERNAL_IMPORT_H
#define Py_INTERNAL_IMPORT_H
#ifdef __cplusplus
extern "C" {
#endif


struct _import_runtime_state {
    /* The builtin modules (defined in config.c). */
    struct _inittab *inittab;
    /* The most recent value assigned to a PyModuleDef.m_base.m_index.
       This is incremented each time PyModuleDef_Init() is called,
       which is just about every time an extension module is imported.
       See PyInterpreterState.modules_by_index for more info. */
    Py_ssize_t last_module_index;
    /* A dict mapping (filename, name) to PyModuleDef for modules.
       Only legacy (single-phase init) extension modules are added
       and only if they support multiple initialization (m_size >- 0)
       or are imported in the main interpreter.
       This is initialized lazily in _PyImport_FixupExtensionObject().
       Modules are added there and looked up in _imp.find_extension(). */
    PyObject *extensions;
    /* The global import lock. */
    struct {
        PyThread_type_lock mutex;
        unsigned long thread;
        int level;
    } lock;
    struct {
        int import_level;
        _PyTime_t accumulated;
        int header;
    } find_and_load;
    /* Package context -- the full module name for package imports */
    const char * pkgcontext;
};


#ifdef HAVE_FORK
extern PyStatus _PyImport_ReInitLock(void);
#endif
extern PyObject* _PyImport_BootstrapImp(PyThreadState *tstate);

struct _module_alias {
    const char *name;                 /* ASCII encoded string */
    const char *orig;                 /* ASCII encoded string */
};

PyAPI_DATA(const struct _frozen *) _PyImport_FrozenBootstrap;
PyAPI_DATA(const struct _frozen *) _PyImport_FrozenStdlib;
PyAPI_DATA(const struct _frozen *) _PyImport_FrozenTest;
extern const struct _module_alias * _PyImport_FrozenAliases;

#ifdef __cplusplus
}
#endif
#endif /* !Py_INTERNAL_IMPORT_H */
#endif /* !Py_LIMITED_API */