Repository navigation
Fix format field parsing and lookup order - #9438
youknowdot wants to merge 2 commits into
Conversation
Assisted-by: OpenAI Codex: model version unavailable
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [x] lib: cpython/Lib/logging dependencies:
dependent tests: (27 tests)
[x] test: cpython/Lib/test/test_str.py (TODO: 2) dependencies: dependent tests: (no tests depend on str) [x] test: cpython/Lib/test/test_source_encoding.py dependencies: dependent tests: (no tests depend on source_encoding) Legend:
|
Regenerate the canonical logging test via update_lib after the native formatter fix. The complete formatter validation method passes without its obsolete expected-failure marker. Assisted-by: OpenAI Codex: model version unavailable
Summary
Fix the native prerequisite for CPython 3.15's full
StrTest.test_formatrather than retaining its expected-failure marker._string.formatter_field_name_splitnow returns a self-iterator with CPython's resumable cursor behavior after parsing errors.!and:inside item keys remain key data; malformed outer fields are rejected before lookup. Conversion happens before nested specification expansion, with an explicit two-level expansion budget rather than a syntax-parser nesting restriction.Lib/test/test_str.pyfrom pinned CPython 3.15.0 usingscripts/update_lib migrate, retiring only the now-passingtest_formatmarker. The other two existing markers are preserved exactly. The same updater also retires the now-passingFormatterTest.test_format_validatemarker inLib/test/test_logging.py, restoring exact pinned canonical bytes. No assertions or new skips were added.Validation
cargo checkand strictcargo clippy -- -D warnings: passed.95544a5b82c7f40c45b169801a45701547762a2cplus this native patch.StrTest.test_format,test_format_map,test_format_auto_numbering,test_format_huge_item_number,StringModuleTest.test_formatter_field_name_split, andModuleTest.test_basic_formatter). The regenerated repository's fulltest_formatalso passes independently. The complete regeneratedFormatterTest.test_format_validatepasses separately (one test, no skips or expected failures); this retires the obsolete marker responsible for the initial hosted Linux unexpected-success failure.d220409a13b77de7a6c30abe16ea90db01528edc: seven suffix-iterator cases and eight lookup cases match, and fourteen outer parser/format cases match. Three additional phase cases match; the known remaining case below is explicitly not fixed.Remaining limits
This does not establish complete CPython formatting parity.
FormatStringstill parses the whole string eagerly: for'{0}{'.format()RustPython reports the later syntax error before the missing first argument, whereas CPython reportsIndexError. Existing numeric-field policy differences (Unicode decimal digits, plus signs and overflow prefixes) remain outside this patch. The local validation base predates the subsequently merged source-decoder and string-interning updates; neither unrelated update is part of the tested binary.Assisted by OpenAI Codex; model version unavailable.