lite_bootstrap/helpers/warn.py walks the stack to find the frame that built a config, because no literal stacklevel can name it (#197). Python 3.12 added warnings.warn(..., skip_file_prefixes=...), which expresses the same intent directly and replaces the walk with one argument.
The floor is 3.10 today, so it is not available yet.
When
Blocked on the floor moving. #174 tracks dropping 3.10; this also needs 3.11 gone, since skip_file_prefixes landed in 3.12.
What to check when it happens
skip_file_prefixes takes file path prefixes, and the current walk skips frames on two rules, not one:
- Frames whose module is under
lite_bootstrap or is dataclasses. Path prefixes cover these, given the installed location of both.
- Any
__init__ whose file is <string>, which is how a dataclass-generated __init__ reports itself. This one is not a path prefix, and it is load-bearing: tests/test_config_cascade.py::test_a_warning_from_a_subclassed_config_still_names_the_line_that_built_it fails without it, because dataclasses writes a subclass's __init__ into the subclass's own module rather than ours.
So the swap is only clean if skip_file_prefixes=("<string>",) is honoured, or if the generated __init__ reports a real path by then. Check both before deleting anything; the two invariant tests in tests/test_config_cascade.py are the gate.
If #202 is resolved by reusing warn_at_caller, this issue covers those call sites too.
Why this is filed rather than left as a comment
The reasoning lived only in the description of #200, which is merged. Nothing surfaces a merged PR description at the moment someone bumps requires-python, and AGENTS.md says real work not scheduled becomes an issue.
lite_bootstrap/helpers/warn.pywalks the stack to find the frame that built a config, because no literalstacklevelcan name it (#197). Python 3.12 addedwarnings.warn(..., skip_file_prefixes=...), which expresses the same intent directly and replaces the walk with one argument.The floor is 3.10 today, so it is not available yet.
When
Blocked on the floor moving. #174 tracks dropping 3.10; this also needs 3.11 gone, since
skip_file_prefixeslanded in 3.12.What to check when it happens
skip_file_prefixestakes file path prefixes, and the current walk skips frames on two rules, not one:lite_bootstrapor isdataclasses. Path prefixes cover these, given the installed location of both.__init__whose file is<string>, which is how a dataclass-generated__init__reports itself. This one is not a path prefix, and it is load-bearing:tests/test_config_cascade.py::test_a_warning_from_a_subclassed_config_still_names_the_line_that_built_itfails without it, becausedataclasseswrites a subclass's__init__into the subclass's own module rather than ours.So the swap is only clean if
skip_file_prefixes=("<string>",)is honoured, or if the generated__init__reports a real path by then. Check both before deleting anything; the two invariant tests intests/test_config_cascade.pyare the gate.If #202 is resolved by reusing
warn_at_caller, this issue covers those call sites too.Why this is filed rather than left as a comment
The reasoning lived only in the description of #200, which is merged. Nothing surfaces a merged PR description at the moment someone bumps
requires-python, andAGENTS.mdsays real work not scheduled becomes an issue.