2021-08-08 04:08:33 +00:00
|
|
|
#ifndef Py_IMPORT_H
|
|
|
|
#define Py_IMPORT_H
|
2021-08-12 07:42:14 +00:00
|
|
|
#include "third_party/python/Include/object.h"
|
2021-08-10 17:26:13 +00:00
|
|
|
COSMOPOLITAN_C_START_
|
2021-08-08 04:08:33 +00:00
|
|
|
|
|
|
|
#ifndef Py_LIMITED_API
|
2021-08-12 07:42:14 +00:00
|
|
|
void _PyImportZip_Init(void);
|
2021-08-08 04:08:33 +00:00
|
|
|
|
|
|
|
PyMODINIT_FUNC PyInit_imp(void);
|
|
|
|
#endif /* !Py_LIMITED_API */
|
2021-08-12 07:42:14 +00:00
|
|
|
long PyImport_GetMagicNumber(void);
|
|
|
|
const char * PyImport_GetMagicTag(void);
|
|
|
|
PyObject * PyImport_ExecCodeModule(
|
2021-08-08 04:08:33 +00:00
|
|
|
const char *name, /* UTF-8 encoded string */
|
|
|
|
PyObject *co
|
|
|
|
);
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyImport_ExecCodeModuleEx(
|
2021-08-08 04:08:33 +00:00
|
|
|
const char *name, /* UTF-8 encoded string */
|
|
|
|
PyObject *co,
|
|
|
|
const char *pathname /* decoded from the filesystem encoding */
|
|
|
|
);
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyImport_ExecCodeModuleWithPathnames(
|
2021-08-08 04:08:33 +00:00
|
|
|
const char *name, /* UTF-8 encoded string */
|
|
|
|
PyObject *co,
|
|
|
|
const char *pathname, /* decoded from the filesystem encoding */
|
|
|
|
const char *cpathname /* decoded from the filesystem encoding */
|
|
|
|
);
|
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyImport_ExecCodeModuleObject(
|
2021-08-08 04:08:33 +00:00
|
|
|
PyObject *name,
|
|
|
|
PyObject *co,
|
|
|
|
PyObject *pathname,
|
|
|
|
PyObject *cpathname
|
|
|
|
);
|
|
|
|
#endif
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyImport_GetModuleDict(void);
|
2021-08-08 04:08:33 +00:00
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyImport_AddModuleObject(
|
2021-08-08 04:08:33 +00:00
|
|
|
PyObject *name
|
|
|
|
);
|
|
|
|
#endif
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyImport_AddModule(
|
2021-08-08 04:08:33 +00:00
|
|
|
const char *name /* UTF-8 encoded string */
|
|
|
|
);
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyImport_ImportModule(
|
2021-08-08 04:08:33 +00:00
|
|
|
const char *name /* UTF-8 encoded string */
|
|
|
|
);
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyImport_ImportModuleNoBlock(
|
2021-08-08 04:08:33 +00:00
|
|
|
const char *name /* UTF-8 encoded string */
|
|
|
|
);
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyImport_ImportModuleLevel(
|
2021-08-08 04:08:33 +00:00
|
|
|
const char *name, /* UTF-8 encoded string */
|
|
|
|
PyObject *globals,
|
|
|
|
PyObject *locals,
|
|
|
|
PyObject *fromlist,
|
|
|
|
int level
|
|
|
|
);
|
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyImport_ImportModuleLevelObject(
|
2021-08-08 04:08:33 +00:00
|
|
|
PyObject *name,
|
|
|
|
PyObject *globals,
|
|
|
|
PyObject *locals,
|
|
|
|
PyObject *fromlist,
|
|
|
|
int level
|
|
|
|
);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define PyImport_ImportModuleEx(n, g, l, f) \
|
|
|
|
PyImport_ImportModuleLevel(n, g, l, f, 0)
|
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * PyImport_GetImporter(PyObject *path);
|
|
|
|
PyObject * PyImport_Import(PyObject *name);
|
|
|
|
PyObject * PyImport_ReloadModule(PyObject *m);
|
|
|
|
void PyImport_Cleanup(void);
|
2022-06-26 12:51:00 +00:00
|
|
|
void _PyImportLookupTables_Init(void);
|
|
|
|
void _PyImportLookupTables_Cleanup(void);
|
2021-08-08 04:08:33 +00:00
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
2021-08-12 07:42:14 +00:00
|
|
|
int PyImport_ImportFrozenModuleObject(
|
2021-08-08 04:08:33 +00:00
|
|
|
PyObject *name
|
|
|
|
);
|
|
|
|
#endif
|
2021-08-12 07:42:14 +00:00
|
|
|
int PyImport_ImportFrozenModule(
|
2021-08-08 04:08:33 +00:00
|
|
|
const char *name /* UTF-8 encoded string */
|
|
|
|
);
|
|
|
|
|
|
|
|
#ifndef Py_LIMITED_API
|
|
|
|
#ifdef WITH_THREAD
|
2021-08-12 07:42:14 +00:00
|
|
|
void _PyImport_AcquireLock(void);
|
|
|
|
int _PyImport_ReleaseLock(void);
|
2021-08-08 04:08:33 +00:00
|
|
|
#else
|
|
|
|
#define _PyImport_AcquireLock()
|
|
|
|
#define _PyImport_ReleaseLock() 1
|
|
|
|
#endif
|
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
void _PyImport_ReInitLock(void);
|
2021-08-08 04:08:33 +00:00
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * _PyImport_FindBuiltin(
|
2021-08-08 04:08:33 +00:00
|
|
|
const char *name /* UTF-8 encoded string */
|
|
|
|
);
|
2021-08-12 07:42:14 +00:00
|
|
|
PyObject * _PyImport_FindExtensionObject(PyObject *, PyObject *);
|
|
|
|
int _PyImport_FixupBuiltin(
|
2021-08-08 04:08:33 +00:00
|
|
|
PyObject *mod,
|
|
|
|
const char *name /* UTF-8 encoded string */
|
|
|
|
);
|
2021-08-12 07:42:14 +00:00
|
|
|
int _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
|
2021-08-08 04:08:33 +00:00
|
|
|
|
|
|
|
struct _inittab {
|
|
|
|
const char *name; /* ASCII encoded string */
|
|
|
|
PyObject* (*initfunc)(void);
|
|
|
|
};
|
2021-09-07 18:40:11 +00:00
|
|
|
extern const struct _inittab _PyImport_Inittab[];
|
2021-08-12 07:42:14 +00:00
|
|
|
extern struct _inittab * PyImport_Inittab;
|
|
|
|
int PyImport_ExtendInittab(struct _inittab *newtab);
|
2021-08-08 04:08:33 +00:00
|
|
|
#endif /* Py_LIMITED_API */
|
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
extern PyTypeObject PyNullImporter_Type;
|
2021-08-08 04:08:33 +00:00
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
int PyImport_AppendInittab(
|
2021-08-08 04:08:33 +00:00
|
|
|
const char *name, /* ASCII encoded string */
|
|
|
|
PyObject* (*initfunc)(void)
|
|
|
|
);
|
|
|
|
|
|
|
|
#ifndef Py_LIMITED_API
|
|
|
|
struct _frozen {
|
|
|
|
const char *name; /* ASCII encoded string */
|
|
|
|
const unsigned char *code;
|
|
|
|
int size;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Embedding apps may change this pointer to point to their favorite
|
|
|
|
collection of frozen modules: */
|
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
extern const struct _frozen * PyImport_FrozenModules;
|
2021-08-18 21:21:30 +00:00
|
|
|
extern const struct _frozen _PyImport_FrozenModules[];
|
2021-08-08 04:08:33 +00:00
|
|
|
#endif
|
|
|
|
|
2021-08-10 17:26:13 +00:00
|
|
|
COSMOPOLITAN_C_END_
|
2021-08-08 04:08:33 +00:00
|
|
|
#endif /* !Py_IMPORT_H */
|