Visitar URL original
gh-100143: Improve collecting pystats for parts of runs by mdboom · Pull Request #100144 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add -Xpystats flag
  • Loading branch information
mdboom committed Dec 9, 2022
commit 63eb98304e4de5bb0e84a527781ffaf46d97edba
15 changes: 14 additions & 1 deletion Python/initconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ The following implementation-specific options are available:\n\
\n\
-X int_max_str_digits=number: limit the size of int<->str conversions.\n\
This helps avoid denial of service attacks when parsing untrusted data.\n\
The default is sys.int_info.default_max_str_digits. 0 disables.";
The default is sys.int_info.default_max_str_digits. 0 disables."

#ifdef Py_STATS
"\n\
\n\
-X pystats: Enable pystats collection at startup."
#endif
;

/* Envvars that don't have equivalent command-line options are listed first */
static const char usage_envvars[] =
Expand Down Expand Up @@ -2188,6 +2195,12 @@ config_read(PyConfig *config, int compute_path_config)
config->show_ref_count = 1;
}

#ifdef Py_STATS
if (config_get_xoption(config, L"pystats")) {
_py_stats = &_py_stats_struct;
}
#endif

status = config_read_complex_options(config);
if (_PyStatus_EXCEPTION(status)) {
return status;
Expand Down