Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
pycore_import.h142 linesDownload Raw Back to internal
1#ifndef Py_LIMITED_API2#ifndef Py_INTERNAL_IMPORT_H3#define Py_INTERNAL_IMPORT_H4#ifdef __cplusplus5extern "C" {6#endif7 8#ifndef Py_BUILD_CORE9#  error "this header requires Py_BUILD_CORE define"10#endif11 12#include "pycore_hashtable.h"     // _Py_hashtable_t13#include "pycore_interp_structs.h" // _import_state14 15extern int _PyImport_IsInitialized(PyInterpreterState *);16 17// Export for 'pyexpat' shared extension18PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module);19 20extern int _PyImport_SetModuleString(const char *name, PyObject* module);21 22extern void _PyImport_AcquireLock(PyInterpreterState *interp);23extern void _PyImport_ReleaseLock(PyInterpreterState *interp);24extern void _PyImport_ReInitLock(PyInterpreterState *interp);25 26// This is used exclusively for the sys and builtins modules:27extern int _PyImport_FixupBuiltin(28    PyThreadState *tstate,29    PyObject *mod,30    const char *name,            /* UTF-8 encoded string */31    PyObject *modules32    );33 34#ifdef HAVE_DLOPEN35#  include <dlfcn.h>              // RTLD_NOW, RTLD_LAZY36#  if HAVE_DECL_RTLD_NOW37#    define _Py_DLOPEN_FLAGS RTLD_NOW38#  else39#    define _Py_DLOPEN_FLAGS RTLD_LAZY40#  endif41#  define DLOPENFLAGS_INIT .dlopenflags = _Py_DLOPEN_FLAGS,42#else43#  define _Py_DLOPEN_FLAGS 044#  define DLOPENFLAGS_INIT45#endif46 47#define IMPORTS_INIT \48    { \49        DLOPENFLAGS_INIT \50        .find_and_load = { \51            .header = 1, \52        }, \53    }54 55extern void _PyImport_ClearCore(PyInterpreterState *interp);56 57extern Py_ssize_t _PyImport_GetNextModuleIndex(void);58extern const char * _PyImport_ResolveNameWithPackageContext(const char *name);59extern const char * _PyImport_SwapPackageContext(const char *newcontext);60 61extern int _PyImport_GetDLOpenFlags(PyInterpreterState *interp);62extern void _PyImport_SetDLOpenFlags(PyInterpreterState *interp, int new_val);63 64extern PyObject * _PyImport_InitModules(PyInterpreterState *interp);65extern PyObject * _PyImport_GetModules(PyInterpreterState *interp);66extern PyObject * _PyImport_GetModulesRef(PyInterpreterState *interp);67extern void _PyImport_ClearModules(PyInterpreterState *interp);68 69extern void _PyImport_ClearModulesByIndex(PyInterpreterState *interp);70 71extern int _PyImport_InitDefaultImportFunc(PyInterpreterState *interp);72extern int _PyImport_IsDefaultImportFunc(73        PyInterpreterState *interp,74        PyObject *func);75 76extern PyObject * _PyImport_GetImportlibLoader(77        PyInterpreterState *interp,78        const char *loader_name);79extern PyObject * _PyImport_GetImportlibExternalLoader(80        PyInterpreterState *interp,81        const char *loader_name);82extern PyObject * _PyImport_BlessMyLoader(83        PyInterpreterState *interp,84        PyObject *module_globals);85extern PyObject * _PyImport_ImportlibModuleRepr(86        PyInterpreterState *interp,87        PyObject *module);88 89 90extern PyStatus _PyImport_Init(void);91extern void _PyImport_Fini(void);92extern void _PyImport_Fini2(void);93 94extern PyStatus _PyImport_InitCore(95        PyThreadState *tstate,96        PyObject *sysmod,97        int importlib);98extern PyStatus _PyImport_InitExternal(PyThreadState *tstate);99extern void _PyImport_FiniCore(PyInterpreterState *interp);100extern void _PyImport_FiniExternal(PyInterpreterState *interp);101 102 103extern PyObject* _PyImport_GetBuiltinModuleNames(void);104 105struct _module_alias {106    const char *name;                 /* ASCII encoded string */107    const char *orig;                 /* ASCII encoded string */108};109 110// Export these 3 symbols for test_ctypes111PyAPI_DATA(const struct _frozen*) _PyImport_FrozenBootstrap;112PyAPI_DATA(const struct _frozen*) _PyImport_FrozenStdlib;113PyAPI_DATA(const struct _frozen*) _PyImport_FrozenTest;114 115extern const struct _module_alias * _PyImport_FrozenAliases;116 117extern int _PyImport_CheckSubinterpIncompatibleExtensionAllowed(118    const char *name);119 120 121// Export for '_testinternalcapi' shared extension122PyAPI_FUNC(int) _PyImport_ClearExtension(PyObject *name, PyObject *filename);123 124#ifdef Py_GIL_DISABLED125// Assuming that the GIL is enabled from a call to126// _PyEval_EnableGILTransient(), resolve the transient request depending on the127// state of the module argument:128// - If module is NULL or a PyModuleObject with md_gil == Py_MOD_GIL_NOT_USED,129//   call _PyEval_DisableGIL().130// - Otherwise, call _PyEval_EnableGILPermanent(). If the GIL was not already131//   enabled permanently, issue a warning referencing the module's name.132//133// This function may raise an exception.134extern int _PyImport_CheckGILForModule(PyObject *module, PyObject *module_name);135#endif136 137#ifdef __cplusplus138}139#endif140#endif /* !Py_INTERNAL_IMPORT_H */141#endif /* !Py_LIMITED_API */142 
codekingpro/portable-devtools · Team Ai