summaryrefslogtreecommitdiffstats
path: root/Python/initconfig.c
diff options
context:
space:
mode:
authorMichael Droettboom <mdboom@gmail.com>2022-12-12 14:50:43 (GMT)
committerGitHub <noreply@github.com>2022-12-12 14:50:43 (GMT)
commit1583c6e326a8454d3c806763620e1329bf6b7cbe (patch)
treed18e4187fa1f991f73d730439325e1532f6ee001 /Python/initconfig.c
parente4ea33b17807d99ed737f800d9b0006957c008d2 (diff)
downloadcpython-1583c6e326a8454d3c806763620e1329bf6b7cbe.zip
cpython-1583c6e326a8454d3c806763620e1329bf6b7cbe.tar.gz
cpython-1583c6e326a8454d3c806763620e1329bf6b7cbe.tar.bz2
GH-100143: Improve collecting pystats for parts of runs (GH-100144)
* pystats off by default * Add -Xpystats flag * Always dump pystats, even if turned off
Diffstat (limited to 'Python/initconfig.c')
-rw-r--r--Python/initconfig.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c
index 64ae987..d05099c 100644
--- a/Python/initconfig.c
+++ b/Python/initconfig.c
@@ -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[] =
@@ -2186,6 +2193,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;