mirror of
https://github.com/johndoe6345789/typthon.git
synced 2026-04-24 13:45:05 +00:00
Fix config and status function patterns
- Fixed PyConfig → TyConfig globally - Fixed _Py_HandleSystemExitAndKeyboardInterrupt → _Ty_* - Fixed _Py_GetEnv, _Py_ClearArgcArgv → _Ty_* - Fixed _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED → _Ty_* - Fixed TyStatus_Ok, TyStatus_Error, TyStatus_NoMemory, TyStatus_Exit function definitions and calls Resolved linker errors. Build is much closer to completion. Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -3413,7 +3413,7 @@ _PyBuiltin_Init(TyInterpreterState *interp)
|
||||
{
|
||||
TyObject *mod, *dict, *debug;
|
||||
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
|
||||
mod = _TyModule_CreateInitialized(&builtinsmodule, PYTHON_API_VERSION);
|
||||
if (mod == NULL)
|
||||
|
||||
@@ -550,7 +550,7 @@ _TyOS_URandomNonblock(void *buffer, Ty_ssize_t size)
|
||||
|
||||
|
||||
TyStatus
|
||||
_Ty_HashRandomization_Init(const PyConfig *config)
|
||||
_Ty_HashRandomization_Init(const TyConfig *config)
|
||||
{
|
||||
void *secret = &_Ty_HashSecret;
|
||||
Ty_ssize_t secret_size = sizeof(_Ty_HashSecret_t);
|
||||
|
||||
@@ -486,7 +486,7 @@ init_own_gil(TyInterpreterState *interp, struct _gil_runtime_state *gil)
|
||||
{
|
||||
assert(!gil_created(gil));
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
gil->enabled = config->enable_gil == _TyConfig_GIL_ENABLE ? INT_MAX : 0;
|
||||
#endif
|
||||
create_gil(gil);
|
||||
@@ -1080,7 +1080,7 @@ _TyEval_InitState(TyInterpreterState *interp)
|
||||
int
|
||||
_TyEval_EnableGILTransient(TyThreadState *tstate)
|
||||
{
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
if (config->enable_gil != _TyConfig_GIL_DEFAULT) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1132,7 +1132,7 @@ _TyEval_EnableGILTransient(TyThreadState *tstate)
|
||||
int
|
||||
_TyEval_EnableGILPermanent(TyThreadState *tstate)
|
||||
{
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
if (config->enable_gil != _TyConfig_GIL_DEFAULT) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1152,7 +1152,7 @@ _TyEval_EnableGILPermanent(TyThreadState *tstate)
|
||||
int
|
||||
_TyEval_DisableGIL(TyThreadState *tstate)
|
||||
{
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
if (config->enable_gil != _TyConfig_GIL_DEFAULT) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1257,7 +1257,7 @@ static inline void run_remote_debugger_script(TyObject *path)
|
||||
|
||||
int _PyRunRemoteDebugger(TyThreadState *tstate)
|
||||
{
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
if (config->remote_debug == 1
|
||||
&& tstate->remote_debugger_support.debugger_pending_call == 1)
|
||||
{
|
||||
|
||||
2
Python/clinic/import.c.h
generated
2
Python/clinic/import.c.h
generated
@@ -397,7 +397,7 @@ TyDoc_STRVAR(_imp__override_frozen_modules_for_tests__doc__,
|
||||
"_override_frozen_modules_for_tests($module, override, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"(internal-only) Override PyConfig.use_frozen_modules.\n"
|
||||
"(internal-only) Override TyConfig.use_frozen_modules.\n"
|
||||
"\n"
|
||||
"(-1: \"off\", 1: \"on\", 0: no override)\n"
|
||||
"See frozen_modules() in Lib/test/support/import_helper.py.");
|
||||
|
||||
2
Python/clinic/sysmodule.c.h
generated
2
Python/clinic/sysmodule.c.h
generated
@@ -1751,7 +1751,7 @@ TyDoc_STRVAR(sys__get_cpu_count_config__doc__,
|
||||
"_get_cpu_count_config($module, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Private function for getting PyConfig.cpu_count");
|
||||
"Private function for getting TyConfig.cpu_count");
|
||||
|
||||
#define SYS__GET_CPU_COUNT_CONFIG_METHODDEF \
|
||||
{"_get_cpu_count_config", (PyCFunction)sys__get_cpu_count_config, METH_NOARGS, sys__get_cpu_count_config__doc__},
|
||||
|
||||
@@ -188,7 +188,7 @@ _Ty_CheckPython3(void)
|
||||
/* For back-compat, also search {sys.prefix}\DLLs, though
|
||||
that has not been a normal install layout for a while */
|
||||
TyInterpreterState *interp = _TyInterpreterState_GET();
|
||||
PyConfig *config = (PyConfig*)_TyInterpreterState_GetConfig(interp);
|
||||
TyConfig *config = (TyConfig*)_TyInterpreterState_GetConfig(interp);
|
||||
assert(config->prefix);
|
||||
if (config->prefix) {
|
||||
wcscpy_s(py3path, MAXPATHLEN, config->prefix);
|
||||
|
||||
@@ -71,7 +71,7 @@ _TyImport_GetDLOpenFlags(TyInterpreterState *interp)
|
||||
|
||||
/* Path config stub - minimal implementation */
|
||||
TyStatus
|
||||
_TyConfig_InitPathConfig(PyConfig *config, int compute_path_config)
|
||||
_TyConfig_InitPathConfig(TyConfig *config, int compute_path_config)
|
||||
{
|
||||
return TyStatus_Ok();
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ Ty_FrozenMain(int argc, char **argv)
|
||||
Ty_ExitStatusException(status);
|
||||
}
|
||||
|
||||
PyConfig config;
|
||||
TyConfig_InitPythonConfig(&config);
|
||||
TyConfig config;
|
||||
TyConfig_InitTyphonConfig(&config);
|
||||
// Suppress errors from getpath.c
|
||||
config.pathconfig_warnings = 0;
|
||||
// Don't parse command line options like -E
|
||||
|
||||
@@ -1561,7 +1561,7 @@ _TyImport_CheckGILForModule(TyObject* module, TyObject *module_name)
|
||||
}
|
||||
}
|
||||
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
if (config->enable_gil == _TyConfig_GIL_DEFAULT && config->verbose) {
|
||||
TySys_FormatStderr("# loading module '%U', which requires the GIL\n",
|
||||
module_name);
|
||||
@@ -4610,7 +4610,7 @@ _imp._override_frozen_modules_for_tests
|
||||
override: int
|
||||
/
|
||||
|
||||
(internal-only) Override PyConfig.use_frozen_modules.
|
||||
(internal-only) Override TyConfig.use_frozen_modules.
|
||||
|
||||
(-1: "off", 1: "on", 0: no override)
|
||||
See frozen_modules() in Lib/test/support/import_helper.py.
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* --- PyConfig setters ------------------------------------------- */
|
||||
/* --- TyConfig setters ------------------------------------------- */
|
||||
|
||||
typedef TyObject* (*config_sys_flag_setter) (int value);
|
||||
|
||||
@@ -54,7 +54,7 @@ config_sys_flag_not(int value)
|
||||
return config_sys_flag_long(value);
|
||||
}
|
||||
|
||||
/* --- PyConfig spec ---------------------------------------------- */
|
||||
/* --- TyConfig spec ---------------------------------------------- */
|
||||
|
||||
typedef enum {
|
||||
PyConfig_MEMBER_INT = 0,
|
||||
@@ -93,7 +93,7 @@ typedef struct {
|
||||
} PyConfigSpec;
|
||||
|
||||
#define SPEC(MEMBER, TYPE, VISIBILITY, sys) \
|
||||
{#MEMBER, offsetof(PyConfig, MEMBER), \
|
||||
{#MEMBER, offsetof(TyConfig, MEMBER), \
|
||||
PyConfig_MEMBER_##TYPE, PyConfig_MEMBER_##VISIBILITY, sys}
|
||||
|
||||
#define SYS_ATTR(name) {name, -1, NULL}
|
||||
@@ -240,7 +240,7 @@ static const PyConfigSpec PYPRECONFIG_SPEC[] = {
|
||||
|
||||
// Forward declarations
|
||||
static TyObject*
|
||||
config_get(const PyConfig *config, const PyConfigSpec *spec,
|
||||
config_get(const TyConfig *config, const PyConfigSpec *spec,
|
||||
int use_sys);
|
||||
|
||||
|
||||
@@ -571,20 +571,20 @@ _Ty_COMP_DIAG_POP
|
||||
|
||||
/* --- TyStatus ----------------------------------------------- */
|
||||
|
||||
TyStatus PyStatus_Ok(void)
|
||||
TyStatus TyStatus_Ok(void)
|
||||
{ return _TyStatus_OK(); }
|
||||
|
||||
TyStatus PyStatus_Error(const char *err_msg)
|
||||
TyStatus TyStatus_Error(const char *err_msg)
|
||||
{
|
||||
assert(err_msg != NULL);
|
||||
return (TyStatus){._type = _TyStatus_TYPE_ERROR,
|
||||
.err_msg = err_msg};
|
||||
}
|
||||
|
||||
TyStatus PyStatus_NoMemory(void)
|
||||
{ return PyStatus_Error("memory allocation failed"); }
|
||||
TyStatus TyStatus_NoMemory(void)
|
||||
{ return TyStatus_Error("memory allocation failed"); }
|
||||
|
||||
TyStatus PyStatus_Exit(int exitcode)
|
||||
TyStatus TyStatus_Exit(int exitcode)
|
||||
{ return _TyStatus_EXIT(exitcode); }
|
||||
|
||||
|
||||
@@ -865,7 +865,7 @@ _Ty_SetArgcArgv(Ty_ssize_t argc, wchar_t * const *argv)
|
||||
}
|
||||
|
||||
|
||||
// _TyConfig_Write() calls _Ty_SetArgcArgv() with PyConfig.orig_argv.
|
||||
// _TyConfig_Write() calls _Ty_SetArgcArgv() with TyConfig.orig_argv.
|
||||
void
|
||||
Ty_GetArgcArgv(int *argc, wchar_t ***argv)
|
||||
{
|
||||
@@ -874,14 +874,14 @@ Ty_GetArgcArgv(int *argc, wchar_t ***argv)
|
||||
}
|
||||
|
||||
|
||||
/* --- PyConfig ---------------------------------------------- */
|
||||
/* --- TyConfig ---------------------------------------------- */
|
||||
|
||||
#define MAX_HASH_SEED 4294967295UL
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
static int
|
||||
config_check_consistency(const PyConfig *config)
|
||||
config_check_consistency(const TyConfig *config)
|
||||
{
|
||||
/* Check config consistency */
|
||||
assert(config->isolated >= 0);
|
||||
@@ -953,7 +953,7 @@ config_check_consistency(const PyConfig *config)
|
||||
|
||||
/* Free memory allocated in config, but don't clear all attributes */
|
||||
void
|
||||
PyConfig_Clear(PyConfig *config)
|
||||
PyConfig_Clear(TyConfig *config)
|
||||
{
|
||||
#define CLEAR(ATTR) \
|
||||
do { \
|
||||
@@ -1000,7 +1000,7 @@ PyConfig_Clear(PyConfig *config)
|
||||
|
||||
|
||||
void
|
||||
_TyConfig_InitCompatConfig(PyConfig *config)
|
||||
_TyConfig_InitCompatConfig(TyConfig *config)
|
||||
{
|
||||
memset(config, 0, sizeof(*config));
|
||||
|
||||
@@ -1065,7 +1065,7 @@ _TyConfig_InitCompatConfig(PyConfig *config)
|
||||
|
||||
|
||||
static void
|
||||
config_init_defaults(PyConfig *config)
|
||||
config_init_defaults(TyConfig *config)
|
||||
{
|
||||
_TyConfig_InitCompatConfig(config);
|
||||
|
||||
@@ -1100,7 +1100,7 @@ config_init_defaults(PyConfig *config)
|
||||
|
||||
|
||||
void
|
||||
PyConfig_InitPythonConfig(PyConfig *config)
|
||||
PyConfig_InitPythonConfig(TyConfig *config)
|
||||
{
|
||||
config_init_defaults(config);
|
||||
|
||||
@@ -1111,7 +1111,7 @@ PyConfig_InitPythonConfig(PyConfig *config)
|
||||
|
||||
|
||||
void
|
||||
PyConfig_InitIsolatedConfig(PyConfig *config)
|
||||
PyConfig_InitIsolatedConfig(TyConfig *config)
|
||||
{
|
||||
config_init_defaults(config);
|
||||
|
||||
@@ -1143,7 +1143,7 @@ PyConfig_InitIsolatedConfig(PyConfig *config)
|
||||
|
||||
/* Copy str into *config_str (duplicate the string) */
|
||||
TyStatus
|
||||
PyConfig_SetString(PyConfig *config, wchar_t **config_str, const wchar_t *str)
|
||||
PyConfig_SetString(TyConfig *config, wchar_t **config_str, const wchar_t *str)
|
||||
{
|
||||
TyStatus status = _Ty_PreInitializeFromConfig(config, NULL);
|
||||
if (_TyStatus_EXCEPTION(status)) {
|
||||
@@ -1167,7 +1167,7 @@ PyConfig_SetString(PyConfig *config, wchar_t **config_str, const wchar_t *str)
|
||||
|
||||
|
||||
static TyStatus
|
||||
config_set_bytes_string(PyConfig *config, wchar_t **config_str,
|
||||
config_set_bytes_string(TyConfig *config, wchar_t **config_str,
|
||||
const char *str, const char *decode_err_msg)
|
||||
{
|
||||
TyStatus status = _Ty_PreInitializeFromConfig(config, NULL);
|
||||
@@ -1205,7 +1205,7 @@ config_set_bytes_string(PyConfig *config, wchar_t **config_str,
|
||||
Pre-initialize Python if needed to ensure that encodings are properly
|
||||
configured. */
|
||||
TyStatus
|
||||
PyConfig_SetBytesString(PyConfig *config, wchar_t **config_str,
|
||||
PyConfig_SetBytesString(TyConfig *config, wchar_t **config_str,
|
||||
const char *str)
|
||||
{
|
||||
return CONFIG_SET_BYTES_STR(config, config_str, str, "string");
|
||||
@@ -1213,7 +1213,7 @@ PyConfig_SetBytesString(PyConfig *config, wchar_t **config_str,
|
||||
|
||||
|
||||
static inline void*
|
||||
config_get_spec_member(const PyConfig *config, const PyConfigSpec *spec)
|
||||
config_get_spec_member(const TyConfig *config, const PyConfigSpec *spec)
|
||||
{
|
||||
return (char *)config + spec->offset;
|
||||
}
|
||||
@@ -1227,7 +1227,7 @@ preconfig_get_spec_member(const TyPreConfig *preconfig, const PyConfigSpec *spec
|
||||
|
||||
|
||||
TyStatus
|
||||
_TyConfig_Copy(PyConfig *config, const PyConfig *config2)
|
||||
_TyConfig_Copy(TyConfig *config, const TyConfig *config2)
|
||||
{
|
||||
PyConfig_Clear(config);
|
||||
|
||||
@@ -1235,7 +1235,7 @@ _TyConfig_Copy(PyConfig *config, const PyConfig *config2)
|
||||
const PyConfigSpec *spec = PYCONFIG_SPEC;
|
||||
for (; spec->name != NULL; spec++) {
|
||||
void *member = config_get_spec_member(config, spec);
|
||||
const void *member2 = config_get_spec_member((PyConfig*)config2, spec);
|
||||
const void *member2 = config_get_spec_member((TyConfig*)config2, spec);
|
||||
switch (spec->type) {
|
||||
case PyConfig_MEMBER_INT:
|
||||
case PyConfig_MEMBER_UINT:
|
||||
@@ -1276,7 +1276,7 @@ _TyConfig_Copy(PyConfig *config, const PyConfig *config2)
|
||||
|
||||
|
||||
TyObject *
|
||||
_TyConfig_AsDict(const PyConfig *config)
|
||||
_TyConfig_AsDict(const TyConfig *config)
|
||||
{
|
||||
TyObject *dict = TyDict_New();
|
||||
if (dict == NULL) {
|
||||
@@ -1356,7 +1356,7 @@ config_dict_get_ulong(TyObject *dict, const char *name, unsigned long *result)
|
||||
|
||||
|
||||
static int
|
||||
config_dict_get_wstr(TyObject *dict, const char *name, PyConfig *config,
|
||||
config_dict_get_wstr(TyObject *dict, const char *name, TyConfig *config,
|
||||
wchar_t **result)
|
||||
{
|
||||
TyObject *item = config_dict_get(dict, name);
|
||||
@@ -1394,7 +1394,7 @@ error:
|
||||
|
||||
|
||||
static int
|
||||
config_dict_get_wstrlist(TyObject *dict, const char *name, PyConfig *config,
|
||||
config_dict_get_wstrlist(TyObject *dict, const char *name, TyConfig *config,
|
||||
PyWideStringList *result)
|
||||
{
|
||||
TyObject *list = config_dict_get(dict, name);
|
||||
@@ -1450,7 +1450,7 @@ error:
|
||||
|
||||
|
||||
static int
|
||||
config_dict_get_xoptions(TyObject *dict, const char *name, PyConfig *config,
|
||||
config_dict_get_xoptions(TyObject *dict, const char *name, TyConfig *config,
|
||||
PyWideStringList *result)
|
||||
{
|
||||
TyObject *xoptions = config_dict_get(dict, name);
|
||||
@@ -1510,7 +1510,7 @@ error:
|
||||
|
||||
|
||||
int
|
||||
_TyConfig_FromDict(PyConfig *config, TyObject *dict)
|
||||
_TyConfig_FromDict(TyConfig *config, TyObject *dict)
|
||||
{
|
||||
if (!TyDict_Check(dict)) {
|
||||
TyErr_SetString(TyExc_TypeError, "dict expected");
|
||||
@@ -1606,7 +1606,7 @@ _TyConfig_FromDict(PyConfig *config, TyObject *dict)
|
||||
|
||||
|
||||
static const char*
|
||||
config_get_env(const PyConfig *config, const char *name)
|
||||
config_get_env(const TyConfig *config, const char *name)
|
||||
{
|
||||
return _Ty_GetEnv(config->use_environment, name);
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ config_get_env(const PyConfig *config, const char *name)
|
||||
Return 0 on success, but *dest can be NULL.
|
||||
Return -1 on memory allocation failure. Return -2 on decoding error. */
|
||||
static TyStatus
|
||||
config_get_env_dup(PyConfig *config,
|
||||
config_get_env_dup(TyConfig *config,
|
||||
wchar_t **dest,
|
||||
wchar_t *wname, char *name,
|
||||
const char *decode_err_msg)
|
||||
@@ -1654,7 +1654,7 @@ config_get_env_dup(PyConfig *config,
|
||||
|
||||
|
||||
static void
|
||||
config_get_global_vars(PyConfig *config)
|
||||
config_get_global_vars(TyConfig *config)
|
||||
{
|
||||
_Ty_COMP_DIAG_PUSH
|
||||
_Ty_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||
@@ -1699,7 +1699,7 @@ _Ty_COMP_DIAG_POP
|
||||
|
||||
/* Set Ty_xxx global configuration variables from 'config' configuration. */
|
||||
static void
|
||||
config_set_global_vars(const PyConfig *config)
|
||||
config_set_global_vars(const TyConfig *config)
|
||||
{
|
||||
_Ty_COMP_DIAG_PUSH
|
||||
_Ty_COMP_DIAG_IGNORE_DEPR_DECLS
|
||||
@@ -1742,13 +1742,13 @@ _Ty_COMP_DIAG_POP
|
||||
|
||||
|
||||
static const wchar_t*
|
||||
config_get_xoption(const PyConfig *config, wchar_t *name)
|
||||
config_get_xoption(const TyConfig *config, wchar_t *name)
|
||||
{
|
||||
return _Ty_get_xoption(&config->xoptions, name);
|
||||
}
|
||||
|
||||
static const wchar_t*
|
||||
config_get_xoption_value(const PyConfig *config, wchar_t *name)
|
||||
config_get_xoption_value(const TyConfig *config, wchar_t *name)
|
||||
{
|
||||
const wchar_t *xoption = config_get_xoption(config, name);
|
||||
if (xoption == NULL) {
|
||||
@@ -1760,7 +1760,7 @@ config_get_xoption_value(const PyConfig *config, wchar_t *name)
|
||||
|
||||
|
||||
static TyStatus
|
||||
config_init_hash_seed(PyConfig *config)
|
||||
config_init_hash_seed(TyConfig *config)
|
||||
{
|
||||
static_assert(sizeof(_Ty_HashSecret_t) == sizeof(_Ty_HashSecret.uc),
|
||||
"_Ty_HashSecret_t has wrong size");
|
||||
@@ -1811,7 +1811,7 @@ config_wstr_to_int(const wchar_t *wstr, int *result)
|
||||
}
|
||||
|
||||
static TyStatus
|
||||
config_read_gil(PyConfig *config, size_t len, wchar_t first_char)
|
||||
config_read_gil(TyConfig *config, size_t len, wchar_t first_char)
|
||||
{
|
||||
if (len == 1 && first_char == L'0') {
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
@@ -1834,7 +1834,7 @@ config_read_gil(PyConfig *config, size_t len, wchar_t first_char)
|
||||
}
|
||||
|
||||
static TyStatus
|
||||
config_read_env_vars(PyConfig *config)
|
||||
config_read_env_vars(TyConfig *config)
|
||||
{
|
||||
TyStatus status;
|
||||
int use_env = config->use_environment;
|
||||
@@ -1923,7 +1923,7 @@ config_read_env_vars(PyConfig *config)
|
||||
}
|
||||
|
||||
static TyStatus
|
||||
config_init_cpu_count(PyConfig *config)
|
||||
config_init_cpu_count(TyConfig *config)
|
||||
{
|
||||
const char *env = config_get_env(config, "PYTHON_CPU_COUNT");
|
||||
if (env) {
|
||||
@@ -1962,7 +1962,7 @@ error:
|
||||
}
|
||||
|
||||
static TyStatus
|
||||
config_init_thread_inherit_context(PyConfig *config)
|
||||
config_init_thread_inherit_context(TyConfig *config)
|
||||
{
|
||||
const char *env = config_get_env(config, "PYTHON_THREAD_INHERIT_CONTEXT");
|
||||
if (env) {
|
||||
@@ -1988,7 +1988,7 @@ config_init_thread_inherit_context(PyConfig *config)
|
||||
}
|
||||
|
||||
static TyStatus
|
||||
config_init_context_aware_warnings(PyConfig *config)
|
||||
config_init_context_aware_warnings(TyConfig *config)
|
||||
{
|
||||
const char *env = config_get_env(config, "PYTHON_CONTEXT_AWARE_WARNINGS");
|
||||
if (env) {
|
||||
@@ -2014,7 +2014,7 @@ config_init_context_aware_warnings(PyConfig *config)
|
||||
}
|
||||
|
||||
static TyStatus
|
||||
config_init_tlbc(PyConfig *config)
|
||||
config_init_tlbc(TyConfig *config)
|
||||
{
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
const char *env = config_get_env(config, "PYTHON_TLBC");
|
||||
@@ -2044,7 +2044,7 @@ config_init_tlbc(PyConfig *config)
|
||||
}
|
||||
|
||||
static TyStatus
|
||||
config_init_perf_profiling(PyConfig *config)
|
||||
config_init_perf_profiling(TyConfig *config)
|
||||
{
|
||||
int active = 0;
|
||||
const char *env = config_get_env(config, "PYTHONPERFSUPPORT");
|
||||
@@ -2079,7 +2079,7 @@ config_init_perf_profiling(PyConfig *config)
|
||||
}
|
||||
|
||||
static TyStatus
|
||||
config_init_remote_debug(PyConfig *config)
|
||||
config_init_remote_debug(TyConfig *config)
|
||||
{
|
||||
#ifndef Ty_REMOTE_DEBUG
|
||||
config->remote_debug = 0;
|
||||
@@ -2101,7 +2101,7 @@ config_init_remote_debug(PyConfig *config)
|
||||
}
|
||||
|
||||
static TyStatus
|
||||
config_init_tracemalloc(PyConfig *config)
|
||||
config_init_tracemalloc(TyConfig *config)
|
||||
{
|
||||
int nframe;
|
||||
int valid;
|
||||
@@ -2145,7 +2145,7 @@ config_init_tracemalloc(PyConfig *config)
|
||||
}
|
||||
|
||||
static TyStatus
|
||||
config_init_int_max_str_digits(PyConfig *config)
|
||||
config_init_int_max_str_digits(TyConfig *config)
|
||||
{
|
||||
int maxdigits;
|
||||
|
||||
@@ -2192,7 +2192,7 @@ config_init_int_max_str_digits(PyConfig *config)
|
||||
}
|
||||
|
||||
static TyStatus
|
||||
config_init_pycache_prefix(PyConfig *config)
|
||||
config_init_pycache_prefix(TyConfig *config)
|
||||
{
|
||||
assert(config->pycache_prefix == NULL);
|
||||
|
||||
@@ -2221,7 +2221,7 @@ config_init_pycache_prefix(PyConfig *config)
|
||||
|
||||
#ifdef Ty_DEBUG
|
||||
static TyStatus
|
||||
config_init_run_presite(PyConfig *config)
|
||||
config_init_run_presite(TyConfig *config)
|
||||
{
|
||||
assert(config->run_presite == NULL);
|
||||
|
||||
@@ -2249,7 +2249,7 @@ config_init_run_presite(PyConfig *config)
|
||||
#endif
|
||||
|
||||
static TyStatus
|
||||
config_init_import_time(PyConfig *config)
|
||||
config_init_import_time(TyConfig *config)
|
||||
{
|
||||
int importtime = 0;
|
||||
|
||||
@@ -2282,7 +2282,7 @@ config_init_import_time(PyConfig *config)
|
||||
}
|
||||
|
||||
static TyStatus
|
||||
config_read_complex_options(PyConfig *config)
|
||||
config_read_complex_options(TyConfig *config)
|
||||
{
|
||||
/* More complex options configured by env var and -X option */
|
||||
if (config->faulthandler < 0) {
|
||||
@@ -2408,7 +2408,7 @@ config_get_stdio_errors(const TyPreConfig *preconfig)
|
||||
|
||||
// See also config_get_fs_encoding()
|
||||
static TyStatus
|
||||
config_get_locale_encoding(PyConfig *config, const TyPreConfig *preconfig,
|
||||
config_get_locale_encoding(TyConfig *config, const TyPreConfig *preconfig,
|
||||
wchar_t **locale_encoding)
|
||||
{
|
||||
wchar_t *encoding;
|
||||
@@ -2428,7 +2428,7 @@ config_get_locale_encoding(PyConfig *config, const TyPreConfig *preconfig,
|
||||
|
||||
|
||||
static TyStatus
|
||||
config_init_stdio_encoding(PyConfig *config,
|
||||
config_init_stdio_encoding(TyConfig *config,
|
||||
const TyPreConfig *preconfig)
|
||||
{
|
||||
TyStatus status;
|
||||
@@ -2513,7 +2513,7 @@ config_init_stdio_encoding(PyConfig *config,
|
||||
|
||||
// See also config_get_locale_encoding()
|
||||
static TyStatus
|
||||
config_get_fs_encoding(PyConfig *config, const TyPreConfig *preconfig,
|
||||
config_get_fs_encoding(TyConfig *config, const TyPreConfig *preconfig,
|
||||
wchar_t **fs_encoding)
|
||||
{
|
||||
#ifdef _Ty_FORCE_UTF8_FS_ENCODING
|
||||
@@ -2544,7 +2544,7 @@ config_get_fs_encoding(PyConfig *config, const TyPreConfig *preconfig,
|
||||
|
||||
|
||||
static TyStatus
|
||||
config_init_fs_encoding(PyConfig *config, const TyPreConfig *preconfig)
|
||||
config_init_fs_encoding(TyConfig *config, const TyPreConfig *preconfig)
|
||||
{
|
||||
TyStatus status;
|
||||
|
||||
@@ -2578,7 +2578,7 @@ config_init_fs_encoding(PyConfig *config, const TyPreConfig *preconfig)
|
||||
|
||||
|
||||
static TyStatus
|
||||
config_init_import(PyConfig *config, int compute_path_config)
|
||||
config_init_import(TyConfig *config, int compute_path_config)
|
||||
{
|
||||
TyStatus status;
|
||||
|
||||
@@ -2596,7 +2596,7 @@ config_init_import(PyConfig *config, int compute_path_config)
|
||||
else if (strcmp(env, "off") == 0) {
|
||||
config->use_frozen_modules = 0;
|
||||
} else {
|
||||
return PyStatus_Error("bad value for PYTHON_FROZEN_MODULES "
|
||||
return TyStatus_Error("bad value for PYTHON_FROZEN_MODULES "
|
||||
"(expected \"on\" or \"off\")");
|
||||
}
|
||||
|
||||
@@ -2615,7 +2615,7 @@ config_init_import(PyConfig *config, int compute_path_config)
|
||||
config->use_frozen_modules = 1;
|
||||
}
|
||||
else {
|
||||
return PyStatus_Error("bad value for option -X frozen_modules "
|
||||
return TyStatus_Error("bad value for option -X frozen_modules "
|
||||
"(expected \"on\" or \"off\")");
|
||||
}
|
||||
|
||||
@@ -2624,14 +2624,14 @@ config_init_import(PyConfig *config, int compute_path_config)
|
||||
}
|
||||
|
||||
TyStatus
|
||||
_TyConfig_InitImportConfig(PyConfig *config)
|
||||
_TyConfig_InitImportConfig(TyConfig *config)
|
||||
{
|
||||
return config_init_import(config, 1);
|
||||
}
|
||||
|
||||
|
||||
static TyStatus
|
||||
config_read(PyConfig *config, int compute_path_config)
|
||||
config_read(TyConfig *config, int compute_path_config)
|
||||
{
|
||||
TyStatus status;
|
||||
const TyPreConfig *preconfig = &_PyRuntime.preconfig;
|
||||
@@ -2746,7 +2746,7 @@ config_read(PyConfig *config, int compute_path_config)
|
||||
|
||||
|
||||
static void
|
||||
config_init_stdio(const PyConfig *config)
|
||||
config_init_stdio(const TyConfig *config)
|
||||
{
|
||||
#if defined(MS_WINDOWS) || defined(__CYGWIN__)
|
||||
/* don't translate newlines (\r\n <=> \n) */
|
||||
@@ -2787,7 +2787,7 @@ config_init_stdio(const PyConfig *config)
|
||||
- set Ty_xxx global configuration variables
|
||||
- initialize C standard streams (stdin, stdout, stderr) */
|
||||
TyStatus
|
||||
_TyConfig_Write(const PyConfig *config, _PyRuntimeState *runtime)
|
||||
_TyConfig_Write(const TyConfig *config, _PyRuntimeState *runtime)
|
||||
{
|
||||
config_set_global_vars(config);
|
||||
|
||||
@@ -2817,7 +2817,7 @@ _TyConfig_Write(const PyConfig *config, _PyRuntimeState *runtime)
|
||||
}
|
||||
|
||||
|
||||
/* --- PyConfig command line parser -------------------------- */
|
||||
/* --- TyConfig command line parser -------------------------- */
|
||||
|
||||
static void
|
||||
config_usage(int error, const wchar_t* program)
|
||||
@@ -2857,7 +2857,7 @@ config_complete_usage(const wchar_t* program)
|
||||
|
||||
/* Parse the command line arguments */
|
||||
static TyStatus
|
||||
config_parse_cmdline(PyConfig *config, PyWideStringList *warnoptions,
|
||||
config_parse_cmdline(TyConfig *config, PyWideStringList *warnoptions,
|
||||
Ty_ssize_t *opt_index)
|
||||
{
|
||||
TyStatus status;
|
||||
@@ -3067,7 +3067,7 @@ config_parse_cmdline(PyConfig *config, PyWideStringList *warnoptions,
|
||||
|
||||
/* Get warning options from PYTHONWARNINGS environment variable. */
|
||||
static TyStatus
|
||||
config_init_env_warnoptions(PyConfig *config, PyWideStringList *warnoptions)
|
||||
config_init_env_warnoptions(TyConfig *config, PyWideStringList *warnoptions)
|
||||
{
|
||||
TyStatus status;
|
||||
/* CONFIG_GET_ENV_DUP requires dest to be initialized to NULL */
|
||||
@@ -3101,7 +3101,7 @@ config_init_env_warnoptions(PyConfig *config, PyWideStringList *warnoptions)
|
||||
|
||||
|
||||
static TyStatus
|
||||
warnoptions_append(PyConfig *config, PyWideStringList *options,
|
||||
warnoptions_append(TyConfig *config, PyWideStringList *options,
|
||||
const wchar_t *option)
|
||||
{
|
||||
/* config_init_warnoptions() add existing config warnoptions at the end:
|
||||
@@ -3121,7 +3121,7 @@ warnoptions_append(PyConfig *config, PyWideStringList *options,
|
||||
|
||||
|
||||
static TyStatus
|
||||
warnoptions_extend(PyConfig *config, PyWideStringList *options,
|
||||
warnoptions_extend(TyConfig *config, PyWideStringList *options,
|
||||
const PyWideStringList *options2)
|
||||
{
|
||||
const Ty_ssize_t len = options2->length;
|
||||
@@ -3138,7 +3138,7 @@ warnoptions_extend(PyConfig *config, PyWideStringList *options,
|
||||
|
||||
|
||||
static TyStatus
|
||||
config_init_warnoptions(PyConfig *config,
|
||||
config_init_warnoptions(TyConfig *config,
|
||||
const PyWideStringList *cmdline_warnoptions,
|
||||
const PyWideStringList *env_warnoptions,
|
||||
const PyWideStringList *sys_warnoptions)
|
||||
@@ -3149,15 +3149,15 @@ config_init_warnoptions(PyConfig *config,
|
||||
/* Priority of warnings options, lowest to highest:
|
||||
*
|
||||
* - any implicit filters added by _warnings.c/warnings.py
|
||||
* - PyConfig.dev_mode: "default" filter
|
||||
* - TyConfig.dev_mode: "default" filter
|
||||
* - PYTHONWARNINGS environment variable
|
||||
* - '-W' command line options
|
||||
* - PyConfig.bytes_warning ('-b' and '-bb' command line options):
|
||||
* - TyConfig.bytes_warning ('-b' and '-bb' command line options):
|
||||
* "default::BytesWarning" or "error::BytesWarning" filter
|
||||
* - early TySys_AddWarnOption() calls
|
||||
* - PyConfig.warnoptions
|
||||
* - TyConfig.warnoptions
|
||||
*
|
||||
* PyConfig.warnoptions is copied to sys.warnoptions. Since the warnings
|
||||
* TyConfig.warnoptions is copied to sys.warnoptions. Since the warnings
|
||||
* module works on the basis of "the most recently added filter will be
|
||||
* checked first", we add the lowest precedence entries first so that later
|
||||
* entries override them.
|
||||
@@ -3203,7 +3203,7 @@ config_init_warnoptions(PyConfig *config,
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Always add all PyConfig.warnoptions options */
|
||||
/* Always add all TyConfig.warnoptions options */
|
||||
status = _TyWideStringList_Extend(&options, &config->warnoptions);
|
||||
if (_TyStatus_EXCEPTION(status)) {
|
||||
goto error;
|
||||
@@ -3220,7 +3220,7 @@ error:
|
||||
|
||||
|
||||
static TyStatus
|
||||
config_update_argv(PyConfig *config, Ty_ssize_t opt_index)
|
||||
config_update_argv(TyConfig *config, Ty_ssize_t opt_index)
|
||||
{
|
||||
const PyWideStringList *cmdline_argv = &config->argv;
|
||||
PyWideStringList config_argv = _TyWideStringList_INIT;
|
||||
@@ -3271,7 +3271,7 @@ config_update_argv(PyConfig *config, Ty_ssize_t opt_index)
|
||||
|
||||
|
||||
static TyStatus
|
||||
core_read_precmdline(PyConfig *config, _PyPreCmdline *precmdline)
|
||||
core_read_precmdline(TyConfig *config, _PyPreCmdline *precmdline)
|
||||
{
|
||||
TyStatus status;
|
||||
|
||||
@@ -3305,7 +3305,7 @@ core_read_precmdline(PyConfig *config, _PyPreCmdline *precmdline)
|
||||
|
||||
/* Get run_filename absolute path */
|
||||
static TyStatus
|
||||
config_run_filename_abspath(PyConfig *config)
|
||||
config_run_filename_abspath(TyConfig *config)
|
||||
{
|
||||
if (!config->run_filename) {
|
||||
return _TyStatus_OK();
|
||||
@@ -3335,7 +3335,7 @@ config_run_filename_abspath(PyConfig *config)
|
||||
|
||||
|
||||
static TyStatus
|
||||
config_read_cmdline(PyConfig *config)
|
||||
config_read_cmdline(TyConfig *config)
|
||||
{
|
||||
TyStatus status;
|
||||
PyWideStringList cmdline_warnoptions = _TyWideStringList_INIT;
|
||||
@@ -3402,7 +3402,7 @@ done:
|
||||
|
||||
|
||||
TyStatus
|
||||
_TyConfig_SetPyArgv(PyConfig *config, const _PyArgv *args)
|
||||
_TyConfig_SetPyArgv(TyConfig *config, const _PyArgv *args)
|
||||
{
|
||||
TyStatus status = _Ty_PreInitializeFromConfig(config, args);
|
||||
if (_TyStatus_EXCEPTION(status)) {
|
||||
@@ -3416,7 +3416,7 @@ _TyConfig_SetPyArgv(PyConfig *config, const _PyArgv *args)
|
||||
/* Set config.argv: decode argv using Ty_DecodeLocale(). Pre-initialize Python
|
||||
if needed to ensure that encodings are properly configured. */
|
||||
TyStatus
|
||||
PyConfig_SetBytesArgv(PyConfig *config, Ty_ssize_t argc, char * const *argv)
|
||||
PyConfig_SetBytesArgv(TyConfig *config, Ty_ssize_t argc, char * const *argv)
|
||||
{
|
||||
_PyArgv args = {
|
||||
.argc = argc,
|
||||
@@ -3428,7 +3428,7 @@ PyConfig_SetBytesArgv(PyConfig *config, Ty_ssize_t argc, char * const *argv)
|
||||
|
||||
|
||||
TyStatus
|
||||
PyConfig_SetArgv(PyConfig *config, Ty_ssize_t argc, wchar_t * const *argv)
|
||||
PyConfig_SetArgv(TyConfig *config, Ty_ssize_t argc, wchar_t * const *argv)
|
||||
{
|
||||
_PyArgv args = {
|
||||
.argc = argc,
|
||||
@@ -3440,7 +3440,7 @@ PyConfig_SetArgv(PyConfig *config, Ty_ssize_t argc, wchar_t * const *argv)
|
||||
|
||||
|
||||
TyStatus
|
||||
PyConfig_SetWideStringList(PyConfig *config, PyWideStringList *list,
|
||||
PyConfig_SetWideStringList(TyConfig *config, PyWideStringList *list,
|
||||
Ty_ssize_t length, wchar_t **items)
|
||||
{
|
||||
TyStatus status = _Ty_PreInitializeFromConfig(config, NULL);
|
||||
@@ -3456,7 +3456,7 @@ PyConfig_SetWideStringList(PyConfig *config, PyWideStringList *list,
|
||||
}
|
||||
|
||||
|
||||
/* Read the configuration into PyConfig from:
|
||||
/* Read the configuration into TyConfig from:
|
||||
|
||||
* Command line arguments
|
||||
* Environment variables
|
||||
@@ -3464,7 +3464,7 @@ PyConfig_SetWideStringList(PyConfig *config, PyWideStringList *list,
|
||||
|
||||
The only side effects are to modify config and to call _Ty_SetArgcArgv(). */
|
||||
TyStatus
|
||||
_TyConfig_Read(PyConfig *config, int compute_path_config)
|
||||
_TyConfig_Read(TyConfig *config, int compute_path_config)
|
||||
{
|
||||
TyStatus status;
|
||||
|
||||
@@ -3524,7 +3524,7 @@ done:
|
||||
|
||||
|
||||
TyStatus
|
||||
PyConfig_Read(PyConfig *config)
|
||||
PyConfig_Read(TyConfig *config)
|
||||
{
|
||||
return _TyConfig_Read(config, 0);
|
||||
}
|
||||
@@ -3564,7 +3564,7 @@ _Ty_GetConfigsAsDict(void)
|
||||
Ty_CLEAR(dict);
|
||||
|
||||
/* core config */
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
dict = _TyConfig_AsDict(config);
|
||||
if (dict == NULL) {
|
||||
goto error;
|
||||
@@ -3630,7 +3630,7 @@ _Ty_DumpPathConfig(TyThreadState *tstate)
|
||||
TySys_WriteStderr("\n"); \
|
||||
} while (0)
|
||||
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
DUMP_CONFIG("PYTHONHOME", home);
|
||||
DUMP_CONFIG("PYTHONPATH", pythonpath_env);
|
||||
DUMP_CONFIG("program name", program_name);
|
||||
@@ -3691,7 +3691,7 @@ _Ty_DumpPathConfig(TyThreadState *tstate)
|
||||
|
||||
struct PyInitConfig {
|
||||
TyPreConfig preconfig;
|
||||
PyConfig config;
|
||||
TyConfig config;
|
||||
struct _inittab *inittab;
|
||||
Ty_ssize_t inittab_size;
|
||||
TyStatus status;
|
||||
@@ -4271,7 +4271,7 @@ error:
|
||||
|
||||
|
||||
TyObject*
|
||||
_TyConfig_CreateXOptionsDict(const PyConfig *config)
|
||||
_TyConfig_CreateXOptionsDict(const TyConfig *config)
|
||||
{
|
||||
TyObject *dict = TyDict_New();
|
||||
if (dict == NULL) {
|
||||
@@ -4292,7 +4292,7 @@ _TyConfig_CreateXOptionsDict(const PyConfig *config)
|
||||
|
||||
|
||||
static int
|
||||
config_get_sys_write_bytecode(const PyConfig *config, int *value)
|
||||
config_get_sys_write_bytecode(const TyConfig *config, int *value)
|
||||
{
|
||||
TyObject *attr = _TySys_GetRequiredAttrString("dont_write_bytecode");
|
||||
if (attr == NULL) {
|
||||
@@ -4310,7 +4310,7 @@ config_get_sys_write_bytecode(const PyConfig *config, int *value)
|
||||
|
||||
|
||||
static TyObject*
|
||||
config_get(const PyConfig *config, const PyConfigSpec *spec,
|
||||
config_get(const TyConfig *config, const PyConfigSpec *spec,
|
||||
int use_sys)
|
||||
{
|
||||
if (use_sys) {
|
||||
@@ -4413,7 +4413,7 @@ PyConfig_Get(const char *name)
|
||||
{
|
||||
const PyConfigSpec *spec = config_find_spec(name);
|
||||
if (spec != NULL) {
|
||||
const PyConfig *config = _Ty_GetConfig();
|
||||
const TyConfig *config = _Ty_GetConfig();
|
||||
return config_get(config, spec, 1);
|
||||
}
|
||||
|
||||
@@ -4509,7 +4509,7 @@ static int
|
||||
config_set_sys_flag(const PyConfigSpec *spec, int int_value)
|
||||
{
|
||||
TyInterpreterState *interp = _TyInterpreterState_GET();
|
||||
PyConfig *config = &interp->config;
|
||||
TyConfig *config = &interp->config;
|
||||
|
||||
if (spec->type == PyConfig_MEMBER_BOOL) {
|
||||
if (int_value != 0) {
|
||||
@@ -4535,7 +4535,7 @@ config_set_sys_flag(const PyConfigSpec *spec, int int_value)
|
||||
goto error;
|
||||
}
|
||||
|
||||
// Set PyConfig.ATTR
|
||||
// Set TyConfig.ATTR
|
||||
assert(spec->type == PyConfig_MEMBER_INT
|
||||
|| spec->type == PyConfig_MEMBER_UINT
|
||||
|| spec->type == PyConfig_MEMBER_BOOL);
|
||||
@@ -4558,12 +4558,12 @@ error:
|
||||
}
|
||||
|
||||
|
||||
// Set PyConfig.ATTR integer member
|
||||
// Set TyConfig.ATTR integer member
|
||||
static int
|
||||
config_set_int_attr(const PyConfigSpec *spec, int value)
|
||||
{
|
||||
TyInterpreterState *interp = _TyInterpreterState_GET();
|
||||
PyConfig *config = &interp->config;
|
||||
TyConfig *config = &interp->config;
|
||||
int *member = config_get_spec_member(config, spec);
|
||||
*member = value;
|
||||
return 0;
|
||||
|
||||
@@ -74,7 +74,7 @@ _TyPathConfig_ClearGlobal(void)
|
||||
}
|
||||
|
||||
TyStatus
|
||||
_TyPathConfig_ReadGlobal(PyConfig *config)
|
||||
_TyPathConfig_ReadGlobal(TyConfig *config)
|
||||
{
|
||||
TyStatus status = _TyStatus_OK();
|
||||
|
||||
@@ -119,7 +119,7 @@ done:
|
||||
}
|
||||
|
||||
TyStatus
|
||||
_TyPathConfig_UpdateGlobal(const PyConfig *config)
|
||||
_TyPathConfig_UpdateGlobal(const TyConfig *config)
|
||||
{
|
||||
#define COPY(ATTR) \
|
||||
do { \
|
||||
|
||||
@@ -40,8 +40,8 @@ _Ty_COMP_DIAG_POP
|
||||
|
||||
|
||||
/* Set Ty_FileSystemDefaultEncoding and Ty_FileSystemDefaultEncodeErrors
|
||||
global configuration variables to PyConfig.filesystem_encoding and
|
||||
PyConfig.filesystem_errors (encoded to UTF-8).
|
||||
global configuration variables to TyConfig.filesystem_encoding and
|
||||
TyConfig.filesystem_errors (encoded to UTF-8).
|
||||
|
||||
Function called by _TyUnicode_InitEncodings(). */
|
||||
int
|
||||
@@ -159,7 +159,7 @@ precmdline_set_preconfig(const _PyPreCmdline *cmdline, TyPreConfig *config)
|
||||
|
||||
|
||||
TyStatus
|
||||
_PyPreCmdline_SetConfig(const _PyPreCmdline *cmdline, PyConfig *config)
|
||||
_PyPreCmdline_SetConfig(const _PyPreCmdline *cmdline, TyConfig *config)
|
||||
{
|
||||
#define COPY_ATTR(ATTR) \
|
||||
config->ATTR = cmdline->ATTR
|
||||
@@ -357,7 +357,7 @@ _TyPreConfig_InitFromPreConfig(TyPreConfig *config,
|
||||
|
||||
|
||||
void
|
||||
_TyPreConfig_InitFromConfig(TyPreConfig *preconfig, const PyConfig *config)
|
||||
_TyPreConfig_InitFromConfig(TyPreConfig *preconfig, const TyConfig *config)
|
||||
{
|
||||
_PyConfigInitEnum config_init = (_PyConfigInitEnum)config->_config_init;
|
||||
switch (config_init) {
|
||||
@@ -446,7 +446,7 @@ fail:
|
||||
|
||||
|
||||
void
|
||||
_TyPreConfig_GetConfig(TyPreConfig *preconfig, const PyConfig *config)
|
||||
_TyPreConfig_GetConfig(TyPreConfig *preconfig, const TyConfig *config)
|
||||
{
|
||||
#define COPY_ATTR(ATTR) \
|
||||
if (config->ATTR != -1) { \
|
||||
|
||||
@@ -399,7 +399,7 @@ _Ty_SetLocaleFromEnv(int category)
|
||||
static int
|
||||
interpreter_update_config(TyThreadState *tstate, int only_update_path_config)
|
||||
{
|
||||
const PyConfig *config = &tstate->interp->config;
|
||||
const TyConfig *config = &tstate->interp->config;
|
||||
|
||||
if (!only_update_path_config) {
|
||||
TyStatus status = _TyConfig_Write(config, tstate->interp->runtime);
|
||||
@@ -442,7 +442,7 @@ interpreter_update_config(TyThreadState *tstate, int only_update_path_config)
|
||||
static TyStatus
|
||||
pyinit_core_reconfigure(_PyRuntimeState *runtime,
|
||||
TyThreadState **tstate_p,
|
||||
const PyConfig *config)
|
||||
const TyConfig *config)
|
||||
{
|
||||
TyStatus status;
|
||||
TyThreadState *tstate = _TyThreadState_GET();
|
||||
@@ -480,7 +480,7 @@ pyinit_core_reconfigure(_PyRuntimeState *runtime,
|
||||
|
||||
static TyStatus
|
||||
pycore_init_runtime(_PyRuntimeState *runtime,
|
||||
const PyConfig *config)
|
||||
const TyConfig *config)
|
||||
{
|
||||
if (runtime->initialized) {
|
||||
return _TyStatus_ERR("main interpreter already initialized");
|
||||
@@ -610,7 +610,7 @@ builtins_dict_watcher(TyDict_WatchEvent event, TyObject *dict, TyObject *key, Ty
|
||||
|
||||
static TyStatus
|
||||
pycore_create_interpreter(_PyRuntimeState *runtime,
|
||||
const PyConfig *src_config,
|
||||
const TyConfig *src_config,
|
||||
TyThreadState **tstate_p)
|
||||
{
|
||||
TyStatus status;
|
||||
@@ -920,7 +920,7 @@ pycore_interp_init(TyThreadState *tstate)
|
||||
goto done;
|
||||
}
|
||||
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
|
||||
status = _TyImport_InitCore(tstate, sysmod, config->_install_importlib);
|
||||
if (_TyStatus_EXCEPTION(status)) {
|
||||
@@ -937,7 +937,7 @@ done:
|
||||
static TyStatus
|
||||
pyinit_config(_PyRuntimeState *runtime,
|
||||
TyThreadState **tstate_p,
|
||||
const PyConfig *config)
|
||||
const TyConfig *config)
|
||||
{
|
||||
TyStatus status = pycore_init_runtime(runtime, config);
|
||||
if (_TyStatus_EXCEPTION(status)) {
|
||||
@@ -1033,7 +1033,7 @@ Ty_PreInitialize(const TyPreConfig *src_config)
|
||||
|
||||
|
||||
TyStatus
|
||||
_Ty_PreInitializeFromConfig(const PyConfig *config,
|
||||
_Ty_PreInitializeFromConfig(const TyConfig *config,
|
||||
const _PyArgv *args)
|
||||
{
|
||||
assert(config != NULL);
|
||||
@@ -1088,7 +1088,7 @@ _Ty_PreInitializeFromConfig(const PyConfig *config,
|
||||
*/
|
||||
static TyStatus
|
||||
pyinit_core(_PyRuntimeState *runtime,
|
||||
const PyConfig *src_config,
|
||||
const TyConfig *src_config,
|
||||
TyThreadState **tstate_p)
|
||||
{
|
||||
TyStatus status;
|
||||
@@ -1098,8 +1098,8 @@ pyinit_core(_PyRuntimeState *runtime,
|
||||
return status;
|
||||
}
|
||||
|
||||
PyConfig config;
|
||||
TyConfig_InitPythonConfig(&config);
|
||||
TyConfig config;
|
||||
TyConfig_InitTyphonConfig(&config);
|
||||
|
||||
status = _TyConfig_Copy(&config, src_config);
|
||||
if (_TyStatus_EXCEPTION(status)) {
|
||||
@@ -1147,7 +1147,7 @@ static void
|
||||
run_presite(TyThreadState *tstate)
|
||||
{
|
||||
TyInterpreterState *interp = tstate->interp;
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
|
||||
if (!config->run_presite) {
|
||||
return;
|
||||
@@ -1181,7 +1181,7 @@ init_interp_main(TyThreadState *tstate)
|
||||
TyStatus status;
|
||||
int is_main_interp = _Ty_IsMainInterpreter(tstate->interp);
|
||||
TyInterpreterState *interp = tstate->interp;
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
|
||||
if (!config->_install_importlib) {
|
||||
/* Special mode for freeze_importlib: run with no import system
|
||||
@@ -1419,7 +1419,7 @@ pyinit_main(TyThreadState *tstate)
|
||||
|
||||
|
||||
TyStatus
|
||||
Ty_InitializeFromConfig(const PyConfig *config)
|
||||
Ty_InitializeFromConfig(const TyConfig *config)
|
||||
{
|
||||
if (config == NULL) {
|
||||
return _TyStatus_ERR("initialization config is NULL");
|
||||
@@ -1467,7 +1467,7 @@ Ty_InitializeEx(int install_sigs)
|
||||
return;
|
||||
}
|
||||
|
||||
PyConfig config;
|
||||
TyConfig config;
|
||||
_TyConfig_InitCompatConfig(&config);
|
||||
|
||||
config.install_signal_handlers = install_sigs;
|
||||
@@ -2319,7 +2319,7 @@ new_interpreter(TyThreadState **tstate_p,
|
||||
}
|
||||
|
||||
/* Copy the current interpreter config into the new interpreter */
|
||||
const PyConfig *src_config;
|
||||
const TyConfig *src_config;
|
||||
if (save_tstate != NULL) {
|
||||
src_config = _TyInterpreterState_GetConfig(save_tstate->interp);
|
||||
}
|
||||
@@ -2619,7 +2619,7 @@ init_import_site(void)
|
||||
|
||||
/* returns Ty_None if the fd is not valid */
|
||||
static TyObject*
|
||||
create_stdio(const PyConfig *config, TyObject* io,
|
||||
create_stdio(const TyConfig *config, TyObject* io,
|
||||
int fd, int write_mode, const char* name,
|
||||
const wchar_t* encoding, const wchar_t* errors)
|
||||
{
|
||||
@@ -2800,7 +2800,7 @@ init_sys_streams(TyThreadState *tstate)
|
||||
int fd;
|
||||
TyObject * encoding_attr;
|
||||
TyStatus res = _TyStatus_OK();
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
|
||||
/* Check that stdin is not a directory
|
||||
Using shell redirection, you can redirect stdin to a directory,
|
||||
|
||||
@@ -656,7 +656,7 @@ init_interpreter(TyInterpreterState *interp,
|
||||
|
||||
_TyEval_InitState(interp);
|
||||
_TyGC_InitState(&interp->gc);
|
||||
TyConfig_InitPythonConfig(&interp->config);
|
||||
TyConfig_InitTyphonConfig(&interp->config);
|
||||
_TyType_InitCache(interp);
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
_Ty_brc_init_state(interp);
|
||||
@@ -2996,14 +2996,14 @@ _TyInterpreterState_SetEvalFrameFunc(TyInterpreterState *interp,
|
||||
}
|
||||
|
||||
|
||||
const PyConfig*
|
||||
const TyConfig*
|
||||
_TyInterpreterState_GetConfig(TyInterpreterState *interp)
|
||||
{
|
||||
return &interp->config;
|
||||
}
|
||||
|
||||
|
||||
const PyConfig*
|
||||
const TyConfig*
|
||||
_Ty_GetConfig(void)
|
||||
{
|
||||
TyThreadState *tstate = current_fast_get();
|
||||
@@ -3227,7 +3227,7 @@ _Ty_IsMainInterpreterFinalizing(TyInterpreterState *interp)
|
||||
}
|
||||
|
||||
|
||||
const PyConfig *
|
||||
const TyConfig *
|
||||
_Ty_GetMainConfig(void)
|
||||
{
|
||||
TyInterpreterState *interp = _TyInterpreterState_Main();
|
||||
|
||||
@@ -382,7 +382,7 @@ _PySysRemoteDebug_SendExec(int pid, int tid, const char *debugger_script_path)
|
||||
#else
|
||||
|
||||
TyThreadState *tstate = _TyThreadState_GET();
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(tstate->interp);
|
||||
if (config->remote_debug != 1) {
|
||||
TyErr_SetString(TyExc_RuntimeError, "Remote debugging is not enabled");
|
||||
return -1;
|
||||
|
||||
@@ -997,7 +997,7 @@ specialize_dict_access_inline(
|
||||
_PyAttrCache *cache = (_PyAttrCache *)(instr + 1);
|
||||
PyDictKeysObject *keys = ((PyHeapTypeObject *)type)->ht_cached_keys;
|
||||
assert(TyUnicode_CheckExact(name));
|
||||
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(owner);
|
||||
_Ty_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(owner);
|
||||
Ty_ssize_t index = _PyDictKeys_StringLookupSplit(keys, name);
|
||||
assert (index != DKIX_ERROR);
|
||||
if (index == DKIX_EMPTY) {
|
||||
@@ -1026,7 +1026,7 @@ specialize_dict_access_hint(
|
||||
{
|
||||
_PyAttrCache *cache = (_PyAttrCache *)(instr + 1);
|
||||
|
||||
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(dict);
|
||||
_Ty_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(dict);
|
||||
#ifdef Ty_GIL_DISABLED
|
||||
_TyDict_EnsureSharedOnRead(dict);
|
||||
#endif
|
||||
|
||||
@@ -425,7 +425,7 @@ _TySys_ClearAuditHooks(TyThreadState *ts)
|
||||
return;
|
||||
}
|
||||
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(ts->interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(ts->interp);
|
||||
if (config->verbose) {
|
||||
TySys_WriteStderr("# clear sys.audit hooks\n");
|
||||
}
|
||||
@@ -953,7 +953,7 @@ sys_getfilesystemencoding_impl(TyObject *module)
|
||||
/*[clinic end generated code: output=1dc4bdbe9be44aa7 input=8475f8649b8c7d8c]*/
|
||||
{
|
||||
TyInterpreterState *interp = _TyInterpreterState_GET();
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
|
||||
if (wcscmp(config->filesystem_encoding, L"utf-8") == 0) {
|
||||
return get_utf8_unicode();
|
||||
@@ -978,7 +978,7 @@ sys_getfilesystemencodeerrors_impl(TyObject *module)
|
||||
/*[clinic end generated code: output=ba77b36bbf7c96f5 input=22a1e8365566f1e5]*/
|
||||
{
|
||||
TyInterpreterState *interp = _TyInterpreterState_GET();
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
TyObject *u = TyUnicode_FromWideChar(config->filesystem_errors, -1);
|
||||
if (u == NULL) {
|
||||
return NULL;
|
||||
@@ -2446,7 +2446,7 @@ sys_is_remote_debug_enabled_impl(TyObject *module)
|
||||
#if !defined(Ty_REMOTE_DEBUG) || !defined(Ty_SUPPORTS_REMOTE_DEBUG)
|
||||
Py_RETURN_FALSE;
|
||||
#else
|
||||
const PyConfig *config = _Ty_GetConfig();
|
||||
const TyConfig *config = _Ty_GetConfig();
|
||||
return TyBool_FromLong(config->remote_debug);
|
||||
#endif
|
||||
}
|
||||
@@ -2614,14 +2614,14 @@ sys__getframemodulename_impl(TyObject *module, int depth)
|
||||
/*[clinic input]
|
||||
sys._get_cpu_count_config -> int
|
||||
|
||||
Private function for getting PyConfig.cpu_count
|
||||
Private function for getting TyConfig.cpu_count
|
||||
[clinic start generated code]*/
|
||||
|
||||
static int
|
||||
sys__get_cpu_count_config_impl(TyObject *module)
|
||||
/*[clinic end generated code: output=36611bb5efad16dc input=523e1ade2204084e]*/
|
||||
{
|
||||
const PyConfig *config = _Ty_GetConfig();
|
||||
const TyConfig *config = _Ty_GetConfig();
|
||||
return config->cpu_count;
|
||||
}
|
||||
|
||||
@@ -2988,7 +2988,7 @@ _TySys_ReadPreinitWarnOptions(PyWideStringList *options)
|
||||
|
||||
|
||||
TyStatus
|
||||
_TySys_ReadPreinitXOptions(PyConfig *config)
|
||||
_TySys_ReadPreinitXOptions(TyConfig *config)
|
||||
{
|
||||
TyStatus status;
|
||||
_Ty_PreInitEntry entry;
|
||||
@@ -3406,7 +3406,7 @@ static int
|
||||
set_flags_from_config(TyInterpreterState *interp, TyObject *flags)
|
||||
{
|
||||
const TyPreConfig *preconfig = &interp->runtime->preconfig;
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
|
||||
// _TySys_UpdateConfig() modifies sys.flags in-place:
|
||||
// Ty_XDECREF() is needed in this case.
|
||||
@@ -3889,14 +3889,14 @@ err_occurred:
|
||||
}
|
||||
|
||||
|
||||
// Update sys attributes for a new PyConfig configuration.
|
||||
// Update sys attributes for a new TyConfig configuration.
|
||||
// This function also adds attributes that _TySys_InitCore() didn't add.
|
||||
int
|
||||
_TySys_UpdateConfig(TyThreadState *tstate)
|
||||
{
|
||||
TyInterpreterState *interp = tstate->interp;
|
||||
TyObject *sysdict = interp->sysdict;
|
||||
const PyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
const TyConfig *config = _TyInterpreterState_GetConfig(interp);
|
||||
int res;
|
||||
|
||||
#define COPY_LIST(KEY, VALUE) \
|
||||
|
||||
Reference in New Issue
Block a user