mirror of
https://github.com/python/cpython.git
synced 2026-04-14 15:50:50 +00:00
gh-122575: gh-142349: fix sys.flags tuple size (it unintentionally increased) (GH-145988)
the lazy imports PEP initial implementation (3.15 alpha) inadvertently incremented the length of the sys.flags tuple. In a way that did not do anything useful or related to the lazy imports setting (it exposed sys.flags.gil in the tuple). This fixes that to hard code the length to the 3.13 & 3.14 released length of 18 and have our tests and code comments make it clear that we've since stopped making new sys.flags attributes available via sequence index.
This commit is contained in:
parent
ec5e3a5a07
commit
4a71946b8f
2 changed files with 33 additions and 13 deletions
|
|
@ -3495,11 +3495,12 @@ static PyStructSequence_Field flags_fields[] = {
|
|||
{"dev_mode", "-X dev"},
|
||||
{"utf8_mode", "-X utf8"},
|
||||
{"warn_default_encoding", "-X warn_default_encoding"},
|
||||
{"safe_path", "-P"},
|
||||
{"safe_path", "-P"},
|
||||
{"int_max_str_digits", "-X int_max_str_digits"},
|
||||
// Fields below are only usable by sys.flags attribute name, not index:
|
||||
{"gil", "-X gil"},
|
||||
{"thread_inherit_context", "-X thread_inherit_context"},
|
||||
{"context_aware_warnings", "-X context_aware_warnings"},
|
||||
{"context_aware_warnings", "-X context_aware_warnings"},
|
||||
{"lazy_imports", "-X lazy_imports"},
|
||||
{0}
|
||||
};
|
||||
|
|
@ -3510,7 +3511,9 @@ static PyStructSequence_Desc flags_desc = {
|
|||
"sys.flags", /* name */
|
||||
flags__doc__, /* doc */
|
||||
flags_fields, /* fields */
|
||||
19
|
||||
18 /* NB - do not increase beyond 3.13's value of 18. */
|
||||
// New sys.flags fields should NOT be tuple addressable per
|
||||
// https://github.com/python/cpython/issues/122575#issuecomment-2416497086
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue