Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 1 | /* Module definition and import interface */ |
| 2 | |
Fred Drake | 5eb6d4e | 2000-07-08 23:37:28 +0000 | [diff] [blame] | 3 | #ifndef Py_IMPORT_H |
| 4 | #define Py_IMPORT_H |
| 5 | #ifdef __cplusplus |
| 6 | extern "C" { |
| 7 | #endif |
Guido van Rossum | 34679b7 | 1993-01-26 13:33:44 +0000 | [diff] [blame] | 8 | |
Mark Hammond | 8235ea1 | 2002-07-19 06:55:41 +0000 | [diff] [blame] | 9 | PyAPI_FUNC(long) PyImport_GetMagicNumber(void); |
Barry Warsaw | 28a691b | 2010-04-17 00:19:56 +0000 | [diff] [blame] | 10 | PyAPI_FUNC(const char *) PyImport_GetMagicTag(void); |
Victor Stinner | d7e7640 | 2011-02-22 23:38:34 +0000 | [diff] [blame] | 11 | PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule( |
Serhiy Storchaka | c679227 | 2013-10-19 21:03:34 +0300 | [diff] [blame] | 12 | const char *name, /* UTF-8 encoded string */ |
Victor Stinner | d7e7640 | 2011-02-22 23:38:34 +0000 | [diff] [blame] | 13 | PyObject *co |
| 14 | ); |
Mark Hammond | 8235ea1 | 2002-07-19 06:55:41 +0000 | [diff] [blame] | 15 | PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx( |
Serhiy Storchaka | c679227 | 2013-10-19 21:03:34 +0300 | [diff] [blame] | 16 | const char *name, /* UTF-8 encoded string */ |
Victor Stinner | d7e7640 | 2011-02-22 23:38:34 +0000 | [diff] [blame] | 17 | PyObject *co, |
Serhiy Storchaka | c679227 | 2013-10-19 21:03:34 +0300 | [diff] [blame] | 18 | const char *pathname /* decoded from the filesystem encoding */ |
Victor Stinner | d7e7640 | 2011-02-22 23:38:34 +0000 | [diff] [blame] | 19 | ); |
Barry Warsaw | 28a691b | 2010-04-17 00:19:56 +0000 | [diff] [blame] | 20 | PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames( |
Serhiy Storchaka | c679227 | 2013-10-19 21:03:34 +0300 | [diff] [blame] | 21 | const char *name, /* UTF-8 encoded string */ |
Victor Stinner | d7e7640 | 2011-02-22 23:38:34 +0000 | [diff] [blame] | 22 | PyObject *co, |
Serhiy Storchaka | c679227 | 2013-10-19 21:03:34 +0300 | [diff] [blame] | 23 | const char *pathname, /* decoded from the filesystem encoding */ |
| 24 | const char *cpathname /* decoded from the filesystem encoding */ |
Victor Stinner | d7e7640 | 2011-02-22 23:38:34 +0000 | [diff] [blame] | 25 | ); |
Serhiy Storchaka | 34d0ac8 | 2016-12-27 14:57:39 +0200 | [diff] [blame] | 26 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 |
Victor Stinner | 27ee089 | 2011-03-04 12:57:09 +0000 | [diff] [blame] | 27 | PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( |
| 28 | PyObject *name, |
| 29 | PyObject *co, |
| 30 | PyObject *pathname, |
| 31 | PyObject *cpathname |
| 32 | ); |
Serhiy Storchaka | 34d0ac8 | 2016-12-27 14:57:39 +0200 | [diff] [blame] | 33 | #endif |
Mark Hammond | 8235ea1 | 2002-07-19 06:55:41 +0000 | [diff] [blame] | 34 | PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); |
Serhiy Storchaka | 4e29f56 | 2018-05-22 20:59:42 +0300 | [diff] [blame] | 35 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 |
Eric Snow | 3f9eee6 | 2017-09-15 16:35:20 -0600 | [diff] [blame] | 36 | PyAPI_FUNC(PyObject *) PyImport_GetModule(PyObject *name); |
Serhiy Storchaka | 4e29f56 | 2018-05-22 20:59:42 +0300 | [diff] [blame] | 37 | #endif |
Serhiy Storchaka | 34d0ac8 | 2016-12-27 14:57:39 +0200 | [diff] [blame] | 38 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 |
Victor Stinner | 27ee089 | 2011-03-04 12:57:09 +0000 | [diff] [blame] | 39 | PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( |
| 40 | PyObject *name |
| 41 | ); |
Serhiy Storchaka | 34d0ac8 | 2016-12-27 14:57:39 +0200 | [diff] [blame] | 42 | #endif |
Victor Stinner | d7e7640 | 2011-02-22 23:38:34 +0000 | [diff] [blame] | 43 | PyAPI_FUNC(PyObject *) PyImport_AddModule( |
| 44 | const char *name /* UTF-8 encoded string */ |
| 45 | ); |
| 46 | PyAPI_FUNC(PyObject *) PyImport_ImportModule( |
| 47 | const char *name /* UTF-8 encoded string */ |
| 48 | ); |
| 49 | PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock( |
| 50 | const char *name /* UTF-8 encoded string */ |
| 51 | ); |
| 52 | PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel( |
Benjamin Peterson | 04778a8 | 2011-05-25 09:29:00 -0500 | [diff] [blame] | 53 | const char *name, /* UTF-8 encoded string */ |
Victor Stinner | d7e7640 | 2011-02-22 23:38:34 +0000 | [diff] [blame] | 54 | PyObject *globals, |
| 55 | PyObject *locals, |
| 56 | PyObject *fromlist, |
| 57 | int level |
| 58 | ); |
Serhiy Storchaka | 34d0ac8 | 2016-12-27 14:57:39 +0200 | [diff] [blame] | 59 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 |
Victor Stinner | fe93faf | 2011-03-14 15:54:52 -0400 | [diff] [blame] | 60 | PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject( |
| 61 | PyObject *name, |
| 62 | PyObject *globals, |
| 63 | PyObject *locals, |
| 64 | PyObject *fromlist, |
| 65 | int level |
| 66 | ); |
Serhiy Storchaka | 34d0ac8 | 2016-12-27 14:57:39 +0200 | [diff] [blame] | 67 | #endif |
Thomas Wouters | f7f438b | 2006-02-28 16:09:29 +0000 | [diff] [blame] | 68 | |
Thomas Wouters | f7f438b | 2006-02-28 16:09:29 +0000 | [diff] [blame] | 69 | #define PyImport_ImportModuleEx(n, g, l, f) \ |
Brett Cannon | 522267e | 2012-08-10 18:55:08 -0400 | [diff] [blame] | 70 | PyImport_ImportModuleLevel(n, g, l, f, 0) |
Thomas Wouters | f7f438b | 2006-02-28 16:09:29 +0000 | [diff] [blame] | 71 | |
Christian Heimes | 9cd1775 | 2007-11-18 19:35:23 +0000 | [diff] [blame] | 72 | PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path); |
Mark Hammond | 8235ea1 | 2002-07-19 06:55:41 +0000 | [diff] [blame] | 73 | PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); |
| 74 | PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); |
Serhiy Storchaka | 34d0ac8 | 2016-12-27 14:57:39 +0200 | [diff] [blame] | 75 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 |
Victor Stinner | 53dc735 | 2011-03-20 01:50:21 +0100 | [diff] [blame] | 76 | PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject( |
| 77 | PyObject *name |
| 78 | ); |
Serhiy Storchaka | 34d0ac8 | 2016-12-27 14:57:39 +0200 | [diff] [blame] | 79 | #endif |
Victor Stinner | d7e7640 | 2011-02-22 23:38:34 +0000 | [diff] [blame] | 80 | PyAPI_FUNC(int) PyImport_ImportFrozenModule( |
Serhiy Storchaka | c679227 | 2013-10-19 21:03:34 +0300 | [diff] [blame] | 81 | const char *name /* UTF-8 encoded string */ |
Victor Stinner | d7e7640 | 2011-02-22 23:38:34 +0000 | [diff] [blame] | 82 | ); |
Fred Drake | 5eb6d4e | 2000-07-08 23:37:28 +0000 | [diff] [blame] | 83 | |
Victor Stinner | d7e7640 | 2011-02-22 23:38:34 +0000 | [diff] [blame] | 84 | PyAPI_FUNC(int) PyImport_AppendInittab( |
| 85 | const char *name, /* ASCII encoded string */ |
| 86 | PyObject* (*initfunc)(void) |
| 87 | ); |
Guido van Rossum | 16926bd | 1998-06-29 20:34:46 +0000 | [diff] [blame] | 88 | |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 89 | #ifndef Py_LIMITED_API |
Victor Stinner | 01b63ec | 2019-06-19 00:48:09 +0200 | [diff] [blame] | 90 | # define Py_CPYTHON_IMPORT_H |
| 91 | # include "cpython/import.h" |
| 92 | # undef Py_CPYTHON_IMPORT_H |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 93 | #endif |
Guido van Rossum | 4ee68d9 | 1996-06-17 17:05:01 +0000 | [diff] [blame] | 94 | |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 95 | #ifdef __cplusplus |
| 96 | } |
| 97 | #endif |
| 98 | #endif /* !Py_IMPORT_H */ |