• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Module definition and import interface */
2 
3 #ifndef Py_IMPORT_H
4 #define Py_IMPORT_H
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
10 PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
11 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
12     const char *name,           /* UTF-8 encoded string */
13     PyObject *co
14     );
15 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
16     const char *name,           /* UTF-8 encoded string */
17     PyObject *co,
18     const char *pathname        /* decoded from the filesystem encoding */
19     );
20 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
21     const char *name,           /* UTF-8 encoded string */
22     PyObject *co,
23     const char *pathname,       /* decoded from the filesystem encoding */
24     const char *cpathname       /* decoded from the filesystem encoding */
25     );
26 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
27 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
28     PyObject *name,
29     PyObject *co,
30     PyObject *pathname,
31     PyObject *cpathname
32     );
33 #endif
34 PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
35 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
36 PyAPI_FUNC(PyObject *) PyImport_GetModule(PyObject *name);
37 #endif
38 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
39 PyAPI_FUNC(PyObject *) PyImport_AddModuleObject(
40     PyObject *name
41     );
42 #endif
43 PyAPI_FUNC(PyObject *) PyImport_AddModule(
44     const char *name            /* UTF-8 encoded string */
45     );
46 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
47 PyAPI_FUNC(PyObject *) PyImport_AddModuleRef(
48     const char *name            /* UTF-8 encoded string */
49     );
50 #endif
51 PyAPI_FUNC(PyObject *) PyImport_ImportModule(
52     const char *name            /* UTF-8 encoded string */
53     );
54 Py_DEPRECATED(3.13) PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
55     const char *name            /* UTF-8 encoded string */
56     );
57 PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(
58     const char *name,           /* UTF-8 encoded string */
59     PyObject *globals,
60     PyObject *locals,
61     PyObject *fromlist,
62     int level
63     );
64 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
65 PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject(
66     PyObject *name,
67     PyObject *globals,
68     PyObject *locals,
69     PyObject *fromlist,
70     int level
71     );
72 #endif
73 
74 #define PyImport_ImportModuleEx(n, g, l, f) \
75     PyImport_ImportModuleLevel((n), (g), (l), (f), 0)
76 
77 PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
78 PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
79 PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
80 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
81 PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
82     PyObject *name
83     );
84 #endif
85 PyAPI_FUNC(int) PyImport_ImportFrozenModule(
86     const char *name            /* UTF-8 encoded string */
87     );
88 
89 PyAPI_FUNC(int) PyImport_AppendInittab(
90     const char *name,           /* ASCII encoded string */
91     PyObject* (*initfunc)(void)
92     );
93 
94 #ifndef Py_LIMITED_API
95 #  define Py_CPYTHON_IMPORT_H
96 #  include "cpython/import.h"
97 #  undef Py_CPYTHON_IMPORT_H
98 #endif
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 #endif /* !Py_IMPORT_H */
104