You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Delete warn_at_caller's frame walk once the floor reaches Python 3.12 #203
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.
Checked 2026-10-03: the floor this needs is 3.14, not 3.12.
skip_file_prefixes exists from 3.12, but only 3.14 skips a frame whose file is <string>. Repro: a package whose dataclass __post_init__ warns with skip_file_prefixes=(<package dir>, <stdlib>/dataclasses, "<string>"), built from a user module three ways:
Build
3.12.13
3.13.15
3.14.7
base config
<string>:4
<string>:4
caller
user subclass
<string>:5
<string>:5
caller
dataclasses.replace
<string>:5
<string>:5
caller
On 3.14, dropping "<string>" from the tuple puts all three back on <string>, so rule 2 of the body is still load-bearing and is honoured there. Sub.__init__.__code__.co_filename is still <string> on all three versions.
So the gate is dropping 3.13 (EOL 2029-10-31), not only 3.10 (#174) and 3.11. Until then the frame walk stays.
Activity
lesnik512 commentedon Oct 3, 2026
Checked 2026-10-03: the floor this needs is 3.14, not 3.12.
skip_file_prefixesexists from 3.12, but only 3.14 skips a frame whose file is<string>. Repro: a package whose dataclass__post_init__warns withskip_file_prefixes=(<package dir>, <stdlib>/dataclasses, "<string>"), built from a user module three ways:<string>:4<string>:4<string>:5<string>:5dataclasses.replace<string>:5<string>:5On 3.14, dropping
"<string>"from the tuple puts all three back on<string>, so rule 2 of the body is still load-bearing and is honoured there.Sub.__init__.__code__.co_filenameis still<string>on all three versions.So the gate is dropping 3.13 (EOL 2029-10-31), not only 3.10 (#174) and 3.11. Until then the frame walk stays.
lesnik512 commentedon Oct 3, 2026
Closing: the swap needs a 3.14 floor (3.13 is EOL 2029-10-31), too far out to track. Reopen if the floor gets there.