Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
pycore_importdl.h140 linesDownload Raw Back to internal
1#ifndef Py_INTERNAL_IMPORTDL_H2#define Py_INTERNAL_IMPORTDL_H3 4#include "patchlevel.h"           // PY_MAJOR_VERSION5 6#ifdef __cplusplus7extern "C" {8#endif9 10#ifndef Py_BUILD_CORE11#  error "this header requires Py_BUILD_CORE define"12#endif13 14 15extern const char *_PyImport_DynLoadFiletab[];16 17 18typedef enum ext_module_kind {19    _Py_ext_module_kind_UNKNOWN = 0,20    _Py_ext_module_kind_SINGLEPHASE = 1,21    _Py_ext_module_kind_MULTIPHASE = 2,22    _Py_ext_module_kind_INVALID = 3,23} _Py_ext_module_kind;24 25typedef enum ext_module_origin {26    _Py_ext_module_origin_CORE = 1,27    _Py_ext_module_origin_BUILTIN = 2,28    _Py_ext_module_origin_DYNAMIC = 3,29} _Py_ext_module_origin;30 31/* Input for loading an extension module. */32struct _Py_ext_module_loader_info {33    PyObject *filename;34#ifndef MS_WINDOWS35    PyObject *filename_encoded;36#endif37    PyObject *name;38    PyObject *name_encoded;39    /* path is always a borrowed ref of name or filename,40     * depending on if it's builtin or not. */41    PyObject *path;42    _Py_ext_module_origin origin;43    const char *hook_prefix;44    const char *newcontext;45};46extern void _Py_ext_module_loader_info_clear(47    struct _Py_ext_module_loader_info *info);48extern int _Py_ext_module_loader_info_init(49    struct _Py_ext_module_loader_info *info,50    PyObject *name,51    PyObject *filename,52    _Py_ext_module_origin origin);53extern int _Py_ext_module_loader_info_init_for_core(54    struct _Py_ext_module_loader_info *p_info,55    PyObject *name);56extern int _Py_ext_module_loader_info_init_for_builtin(57    struct _Py_ext_module_loader_info *p_info,58    PyObject *name);59#ifdef HAVE_DYNAMIC_LOADING60extern int _Py_ext_module_loader_info_init_from_spec(61    struct _Py_ext_module_loader_info *info,62    PyObject *spec);63#endif64 65/* The result from running an extension module's init function. */66struct _Py_ext_module_loader_result {67    PyModuleDef *def;68    PyObject *module;69    _Py_ext_module_kind kind;70    struct _Py_ext_module_loader_result_error *err;71    struct _Py_ext_module_loader_result_error {72        enum _Py_ext_module_loader_result_error_kind {73            _Py_ext_module_loader_result_EXCEPTION = 0,74            _Py_ext_module_loader_result_ERR_MISSING = 1,75            _Py_ext_module_loader_result_ERR_UNREPORTED_EXC = 2,76            _Py_ext_module_loader_result_ERR_UNINITIALIZED = 3,77            _Py_ext_module_loader_result_ERR_NONASCII_NOT_MULTIPHASE = 4,78            _Py_ext_module_loader_result_ERR_NOT_MODULE = 5,79            _Py_ext_module_loader_result_ERR_MISSING_DEF = 6,80        } kind;81        PyObject *exc;82    } _err;83};84extern void _Py_ext_module_loader_result_clear(85    struct _Py_ext_module_loader_result *res);86extern void _Py_ext_module_loader_result_apply_error(87    struct _Py_ext_module_loader_result *res,88    const char *name);89 90/* The module init function. */91typedef PyObject *(*PyModInitFunction)(void);92#ifdef HAVE_DYNAMIC_LOADING93extern PyModInitFunction _PyImport_GetModInitFunc(94    struct _Py_ext_module_loader_info *info,95    FILE *fp);96#endif97extern int _PyImport_RunModInitFunc(98    PyModInitFunction p0,99    struct _Py_ext_module_loader_info *info,100    struct _Py_ext_module_loader_result *p_res);101 102 103/* Max length of module suffix searched for -- accommodates "module.slb" */104#define MAXSUFFIXSIZE 12105 106#ifdef MS_WINDOWS107#include <windows.h>108typedef FARPROC dl_funcptr;109 110#ifdef _DEBUG111#  define PYD_DEBUG_SUFFIX "_d"112#else113#  define PYD_DEBUG_SUFFIX ""114#endif115 116#ifdef Py_GIL_DISABLED117#  define PYD_THREADING_TAG "t"118#else119#  define PYD_THREADING_TAG ""120#endif121 122#ifdef PYD_PLATFORM_TAG123#  define PYD_SOABI "cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) PYD_THREADING_TAG "-" PYD_PLATFORM_TAG124#else125#  define PYD_SOABI "cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) PYD_THREADING_TAG126#endif127 128#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX "." PYD_SOABI ".pyd"129#define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd"130 131#else132typedef void (*dl_funcptr)(void);133#endif134 135 136#ifdef __cplusplus137}138#endif139#endif /* !Py_INTERNAL_IMPORTDL_H */140 
codekingpro/portable-devtools · Team Ai