#ifndef Py_PYCORECONFIG_H#define Py_PYCORECONFIG_H#ifndef Py_LIMITED_API#ifdef __cplusplusextern "C" {#endif/* --- PyStatus ----------------------------------------------- */typedef struct {enum {_PyStatus_TYPE_OK=0,_PyStatus_TYPE_ERROR=1,_PyStatus_TYPE_EXIT=2} _type;const char *func;const char *err_msg;int exitcode;} PyStatus;PyAPI_FUNC(PyStatus) PyStatus_Ok(void);PyAPI_FUNC(PyStatus) PyStatus_Error(const char *err_msg);PyAPI_FUNC(PyStatus) PyStatus_NoMemory(void);PyAPI_FUNC(PyStatus) PyStatus_Exit(int exitcode);PyAPI_FUNC(int) PyStatus_IsError(PyStatus err);PyAPI_FUNC(int) PyStatus_IsExit(PyStatus err);PyAPI_FUNC(int) PyStatus_Exception(PyStatus err);/* --- PyWideStringList ------------------------------------------------ */typedef struct {/* If length is greater than zero, items must be non-NULLand all items strings must be non-NULL */Py_ssize_t length;wchar_t **items;} PyWideStringList;PyAPI_FUNC(PyStatus) PyWideStringList_Append(PyWideStringList *list,const wchar_t *item);PyAPI_FUNC(PyStatus) PyWideStringList_Insert(PyWideStringList *list,Py_ssize_t index,const wchar_t *item);/* --- PyPreConfig ----------------------------------------------- */typedef struct {int _config_init; /* _PyConfigInitEnum value *//* Parse Py_PreInitializeFromBytesArgs() arguments?See PyConfig.parse_argv */int parse_argv;/* If greater than 0, enable isolated mode: sys.path containsneither the script's directory nor the user's site-packages directory.Set to 1 by the -I command line option. If set to -1 (default), inheritPy_IsolatedFlag value. */int isolated;/* If greater than 0: use environment variables.Set to 0 by -E command line option. If set to -1 (default), it isset to !Py_IgnoreEnvironmentFlag. */int use_environment;/* Set the LC_CTYPE locale to the user preferred locale? If equals to 0,set coerce_c_locale and coerce_c_locale_warn to 0. */int configure_locale;/* Coerce the LC_CTYPE locale if it's equal to "C"? (PEP 538)Set to 0 by PYTHONCOERCECLOCALE=0. Set to 1 by PYTHONCOERCECLOCALE=1.Set to 2 if the user preferred LC_CTYPE locale is "C".If it is equal to 1, LC_CTYPE locale is read to decide if it should becoerced or not (ex: PYTHONCOERCECLOCALE=1). Internally, it is set to 2if the LC_CTYPE locale must be coerced.Disable by default (set to 0). Set it to -1 to let Python decide if itshould be enabled or not. */int coerce_c_locale;/* Emit a warning if the LC_CTYPE locale is coerced?Set to 1 by PYTHONCOERCECLOCALE=warn.Disable by default (set to 0). Set it to -1 to let Python decide if itshould be enabled or not. */int coerce_c_locale_warn;#ifdef MS_WINDOWS/* If greater than 1, use the "mbcs" encoding instead of the UTF-8encoding for the filesystem encoding.Set to 1 if the PYTHONLEGACYWINDOWSFSENCODING environment variable isset to a non-empty string. If set to -1 (default), inheritPy_LegacyWindowsFSEncodingFlag value.See PEP 529 for more details. */int legacy_windows_fs_encoding;#endif/* Enable UTF-8 mode? (PEP 540)Disabled by default (equals to 0).Set to 1 by "-X utf8" and "-X utf8=1" command line options.Set to 1 by PYTHONUTF8=1 environment variable.Set to 0 by "-X utf8=0" and PYTHONUTF8=0.If equals to -1, it is set to 1 if the LC_CTYPE locale is "C" or"POSIX", otherwise it is set to 0. Inherit Py_UTF8Mode value value. */int utf8_mode;int dev_mode; /* Development mode. PYTHONDEVMODE, -X dev *//* Memory allocator: PYTHONMALLOC env var.See PyMemAllocatorName for valid values. */int allocator;} PyPreConfig;PyAPI_FUNC(void) PyPreConfig_InitPythonConfig(PyPreConfig *config);PyAPI_FUNC(void) PyPreConfig_InitIsolatedConfig(PyPreConfig *config);/* --- PyConfig ---------------------------------------------- */typedef struct {int _config_init; /* _PyConfigInitEnum value */int isolated; /* Isolated mode? see PyPreConfig.isolated */int use_environment; /* Use environment variables? see PyPreConfig.use_environment */int dev_mode; /* Development mode? See PyPreConfig.dev_mode *//* Install signal handlers? Yes by default. */int install_signal_handlers;int use_hash_seed; /* PYTHONHASHSEED=x */unsigned long hash_seed;/* Enable faulthandler?Set to 1 by -X faulthandler and PYTHONFAULTHANDLER. -1 means unset. */int faulthandler;/* Enable tracemalloc?Set by -X tracemalloc=N and PYTHONTRACEMALLOC. -1 means unset */int tracemalloc;int import_time; /* PYTHONPROFILEIMPORTTIME, -X importtime */int show_ref_count; /* -X showrefcount */int show_alloc_count; /* -X showalloccount */int dump_refs; /* PYTHONDUMPREFS */int malloc_stats; /* PYTHONMALLOCSTATS *//* Python filesystem encoding and error handler:sys.getfilesystemencoding() and sys.getfilesystemencodeerrors().Default encoding and error handler:* if Py_SetStandardStreamEncoding() has been called: they have thehighest priority;* PYTHONIOENCODING environment variable;* The UTF-8 Mode uses UTF-8/surrogateescape;* If Python forces the usage of the ASCII encoding (ex: C localeor POSIX locale on FreeBSD or HP-UX), use ASCII/surrogateescape;* locale encoding: ANSI code page on Windows, UTF-8 on Android andVxWorks, LC_CTYPE locale encoding on other platforms;* On Windows, "surrogateescape" error handler;* "surrogateescape" error handler if the LC_CTYPE locale is "C" or "POSIX";* "surrogateescape" error handler if the LC_CTYPE locale has been coerced(PEP 538);* "strict" error handler.Supported error handlers: "strict", "surrogateescape" and"surrogatepass". The surrogatepass error handler is only supportedif Py_DecodeLocale() and Py_EncodeLocale() use directly the UTF-8 codec;it's only used on Windows.initfsencoding() updates the encoding to the Python codec name.For example, "ANSI_X3.4-1968" is replaced with "ascii".On Windows, sys._enablelegacywindowsfsencoding() sets theencoding/errors to mbcs/replace at runtime.See Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors.*/wchar_t *filesystem_encoding;wchar_t *filesystem_errors;wchar_t *pycache_prefix; /* PYTHONPYCACHEPREFIX, -X pycache_prefix=PATH */int parse_argv; /* Parse argv command line arguments? *//* Command line arguments (sys.argv).Set parse_argv to 1 to parse argv as Python command line argumentsand then strip Python arguments from argv.If argv is empty, an empty string is added to ensure that sys.argvalways exists and is never empty. */PyWideStringList argv;/* Program name:- If Py_SetProgramName() was called, use its value.- On macOS, use PYTHONEXECUTABLE environment variable if set.- If WITH_NEXT_FRAMEWORK macro is defined, use __PYVENV_LAUNCHER__environment variable is set.- Use argv[0] if available and non-empty.- Use "python" on Windows, or "python3 on other platforms. */wchar_t *program_name;PyWideStringList xoptions; /* Command line -X options *//* Warnings options: lowest to highest priority. warnings.filtersis built in the reverse order (highest to lowest priority). */PyWideStringList warnoptions;/* If equal to zero, disable the import of the module site and thesite-dependent manipulations of sys.path that it entails. Also disablethese manipulations if site is explicitly imported later (callsite.main() if you want them to be triggered).Set to 0 by the -S command line option. If set to -1 (default), it isset to !Py_NoSiteFlag. */int site_import;/* Bytes warnings:* If equal to 1, issue a warning when comparing bytes or bytearray withstr or bytes with int.* If equal or greater to 2, issue an error.Incremented by the -b command line option. If set to -1 (default), inheritPy_BytesWarningFlag value. */int bytes_warning;/* If greater than 0, enable inspect: when a script is passed as firstargument or the -c option is used, enter interactive mode afterexecuting the script or the command, even when sys.stdin does not appearto be a terminal.Incremented by the -i command line option. Set to 1 if the PYTHONINSPECTenvironment variable is non-empty. If set to -1 (default), inheritPy_InspectFlag value. */int inspect;/* If greater than 0: enable the interactive mode (REPL).Incremented by the -i command line option. If set to -1 (default),inherit Py_InteractiveFlag value. */int interactive;/* Optimization level.Incremented by the -O command line option. Set by the PYTHONOPTIMIZEenvironment variable. If set to -1 (default), inherit Py_OptimizeFlagvalue. */int optimization_level;/* If greater than 0, enable the debug mode: turn on parser debuggingoutput (for expert only, depending on compilation options).Incremented by the -d command line option. Set by the PYTHONDEBUGenvironment variable. If set to -1 (default), inherit Py_DebugFlagvalue. */int parser_debug;/* If equal to 0, Python won't try to write ``.pyc`` files on theimport of source modules.Set to 0 by the -B command line option and the PYTHONDONTWRITEBYTECODEenvironment variable. If set to -1 (default), it is set to!Py_DontWriteBytecodeFlag. */int write_bytecode;/* If greater than 0, enable the verbose mode: print a message each time amodule is initialized, showing the place (filename or built-in module)from which it is loaded.If greater or equal to 2, print a message for each file that is checkedfor when searching for a module. Also provides information on modulecleanup at exit.Incremented by the -v option. Set by the PYTHONVERBOSE environmentvariable. If set to -1 (default), inherit Py_VerboseFlag value. */int verbose;/* If greater than 0, enable the quiet mode: Don't display the copyrightand version messages even in interactive mode.Incremented by the -q option. If set to -1 (default), inheritPy_QuietFlag value. */int quiet;/* If greater than 0, don't add the user site-packages directory tosys.path.Set to 0 by the -s and -I command line options , and the PYTHONNOUSERSITEenvironment variable. If set to -1 (default), it is set to!Py_NoUserSiteDirectory. */int user_site_directory;/* If non-zero, configure C standard steams (stdio, stdout,stderr):- Set O_BINARY mode on Windows.- If buffered_stdio is equal to zero, make streams unbuffered.Otherwise, enable streams buffering if interactive is non-zero. */int configure_c_stdio;/* If equal to 0, enable unbuffered mode: force the stdout and stderrstreams to be unbuffered.Set to 0 by the -u option. Set by the PYTHONUNBUFFERED environmentvariable.If set to -1 (default), it is set to !Py_UnbufferedStdioFlag. */int buffered_stdio;/* Encoding of sys.stdin, sys.stdout and sys.stderr.Value set from PYTHONIOENCODING environment variable andPy_SetStandardStreamEncoding() function.See also 'stdio_errors' attribute. */wchar_t *stdio_encoding;/* Error handler of sys.stdin and sys.stdout.Value set from PYTHONIOENCODING environment variable andPy_SetStandardStreamEncoding() function.See also 'stdio_encoding' attribute. */wchar_t *stdio_errors;#ifdef MS_WINDOWS/* If greater than zero, use io.FileIO instead of WindowsConsoleIO for sysstandard streams.Set to 1 if the PYTHONLEGACYWINDOWSSTDIO environment variable is set toa non-empty string. If set to -1 (default), inheritPy_LegacyWindowsStdioFlag value.See PEP 528 for more details. */int legacy_windows_stdio;#endif/* Value of the --check-hash-based-pycs command line option:- "default" means the 'check_source' flag in hash-based pycsdetermines invalidation- "always" causes the interpreter to hash the source file forinvalidation regardless of value of 'check_source' bit- "never" causes the interpreter to always assume hash-based pycs arevalidThe default value is "default".See PEP 552 "Deterministic pycs" for more details. */wchar_t *check_hash_pycs_mode;/* --- Path configuration inputs ------------ *//* If greater than 0, suppress _PyPathConfig_Calculate() warnings on Unix.The parameter has no effect on Windows.If set to -1 (default), inherit !Py_FrozenFlag value. */int pathconfig_warnings;wchar_t *pythonpath_env; /* PYTHONPATH environment variable */wchar_t *home; /* PYTHONHOME environment variable,see also Py_SetPythonHome(). *//* --- Path configuration outputs ----------- */int module_search_paths_set; /* If non-zero, use module_search_paths */PyWideStringList module_search_paths; /* sys.path paths. Computed ifmodule_search_paths_set is equalto zero. */wchar_t *executable; /* sys.executable */wchar_t *base_executable; /* sys._base_executable */wchar_t *prefix; /* sys.prefix */wchar_t *base_prefix; /* sys.base_prefix */wchar_t *exec_prefix; /* sys.exec_prefix */wchar_t *base_exec_prefix; /* sys.base_exec_prefix *//* --- Parameter only used by Py_Main() ---------- *//* Skip the first line of the source ('run_filename' parameter), allowing use of non-Unix forms of"#!cmd". This is intended for a DOS specific hack only.Set by the -x command line option. */int skip_source_first_line;wchar_t *run_command; /* -c command line argument */wchar_t *run_module; /* -m command line argument */wchar_t *run_filename; /* Trailing command line argument without -c or -m *//* --- Private fields ---------------------------- *//* Install importlib? If set to 0, importlib is not initialized at all.Needed by freeze_importlib. */int _install_importlib;/* If equal to 0, stop Python initialization before the "main" phase */int _init_main;} PyConfig;PyAPI_FUNC(void) PyConfig_InitPythonConfig(PyConfig *config);PyAPI_FUNC(void) PyConfig_InitIsolatedConfig(PyConfig *config);PyAPI_FUNC(void) PyConfig_Clear(PyConfig *);PyAPI_FUNC(PyStatus) PyConfig_SetString(PyConfig *config,wchar_t **config_str,const wchar_t *str);PyAPI_FUNC(PyStatus) PyConfig_SetBytesString(PyConfig *config,wchar_t **config_str,const char *str);PyAPI_FUNC(PyStatus) PyConfig_Read(PyConfig *config);PyAPI_FUNC(PyStatus) PyConfig_SetBytesArgv(PyConfig *config,Py_ssize_t argc,char * const *argv);PyAPI_FUNC(PyStatus) PyConfig_SetArgv(PyConfig *config,Py_ssize_t argc,wchar_t * const *argv);PyAPI_FUNC(PyStatus) PyConfig_SetWideStringList(PyConfig *config,PyWideStringList *list,Py_ssize_t length, wchar_t **items);#ifdef __cplusplus}#endif#endif /* !Py_LIMITED_API */#endif /* !Py_PYCORECONFIG_H */
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。