mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-131591: Implement PEP 768 (#131937)
Co-authored-by: Ivona Stojanovic <stojanovic.i@hotmail.com> Co-authored-by: Matt Wozniski <godlygeek@gmail.com>
This commit is contained in:
parent
275056a7fd
commit
943cc1431e
31 changed files with 1796 additions and 2 deletions
|
@ -162,6 +162,7 @@ static const PyConfigSpec PYCONFIG_SPEC[] = {
|
|||
SPEC(parse_argv, BOOL, READ_ONLY, NO_SYS),
|
||||
SPEC(pathconfig_warnings, BOOL, READ_ONLY, NO_SYS),
|
||||
SPEC(perf_profiling, UINT, READ_ONLY, NO_SYS),
|
||||
SPEC(remote_debug, BOOL, READ_ONLY, NO_SYS),
|
||||
SPEC(program_name, WSTR, READ_ONLY, NO_SYS),
|
||||
SPEC(run_command, WSTR_OPT, READ_ONLY, NO_SYS),
|
||||
SPEC(run_filename, WSTR_OPT, READ_ONLY, NO_SYS),
|
||||
|
@ -317,6 +318,7 @@ The following implementation-specific options are available:\n\
|
|||
-X perf: support the Linux \"perf\" profiler; also PYTHONPERFSUPPORT=1\n\
|
||||
-X perf_jit: support the Linux \"perf\" profiler with DWARF support;\n\
|
||||
also PYTHON_PERF_JIT_SUPPORT=1\n\
|
||||
-X disable-remote-debug: disable remote debugging; also PYTHON_DISABLE_REMOTE_DEBUG\n\
|
||||
"
|
||||
#ifdef Py_DEBUG
|
||||
"-X presite=MOD: import this module before site; also PYTHON_PRESITE\n"
|
||||
|
@ -994,6 +996,7 @@ _PyConfig_InitCompatConfig(PyConfig *config)
|
|||
config->faulthandler = -1;
|
||||
config->tracemalloc = -1;
|
||||
config->perf_profiling = -1;
|
||||
config->remote_debug = -1;
|
||||
config->module_search_paths_set = 0;
|
||||
config->parse_argv = 0;
|
||||
config->site_import = -1;
|
||||
|
@ -1986,6 +1989,28 @@ config_init_perf_profiling(PyConfig *config)
|
|||
|
||||
}
|
||||
|
||||
static PyStatus
|
||||
config_init_remote_debug(PyConfig *config)
|
||||
{
|
||||
#ifndef Py_REMOTE_DEBUG
|
||||
config->remote_debug = 0;
|
||||
#else
|
||||
int active = 1;
|
||||
const char *env = Py_GETENV("PYTHON_DISABLE_REMOTE_DEBUG");
|
||||
if (env) {
|
||||
active = 0;
|
||||
}
|
||||
const wchar_t *xoption = config_get_xoption(config, L"disable-remote-debug");
|
||||
if (xoption) {
|
||||
active = 0;
|
||||
}
|
||||
|
||||
config->remote_debug = active;
|
||||
#endif
|
||||
return _PyStatus_OK();
|
||||
|
||||
}
|
||||
|
||||
static PyStatus
|
||||
config_init_tracemalloc(PyConfig *config)
|
||||
{
|
||||
|
@ -2170,6 +2195,13 @@ config_read_complex_options(PyConfig *config)
|
|||
}
|
||||
}
|
||||
|
||||
if (config->remote_debug < 0) {
|
||||
status = config_init_remote_debug(config);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
if (config->int_max_str_digits < 0) {
|
||||
status = config_init_int_max_str_digits(config);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
|
@ -2531,6 +2563,9 @@ config_read(PyConfig *config, int compute_path_config)
|
|||
if (config->perf_profiling < 0) {
|
||||
config->perf_profiling = 0;
|
||||
}
|
||||
if (config->remote_debug < 0) {
|
||||
config->remote_debug = -1;
|
||||
}
|
||||
if (config->use_hash_seed < 0) {
|
||||
config->use_hash_seed = 0;
|
||||
config->hash_seed = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue