Skip to content

_zoneinfo: reject empty quoted POSIX TZ abbreviations - #9017

Merged
youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:fix-zoneinfo-empty-abbreviations
Oct 9, 2026
Merged

youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:fix-zoneinfo-empty-abbreviations

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Split the Python 3.14-compatible empty-abbreviation fix from #8954.

Reject an empty quoted abbreviation in the native POSIX TZ rule parser, for both standard and daylight-saving names. CPython 3.14 already rejects these inputs. Keep valid quoted names working.

Add a focused snippet using a minimal TZif fixture. The existing shared canonical cases do not cover empty quoted abbreviations; this leaves the pure-Python library and its assertions unchanged.

Validation

  • Reproduced the failure on main d0dfcb54 through the snippet runner: ValueError was not raised for <>5.
  • The same snippet passes with this patch and on CPython 3.14.7.
  • All four existing CTZStrTest canonical tests pass unchanged.
  • Release workspace test targets compile with --no-run, excluding WASM, venvlauncher, and C API; the separate C-API test target also compiles with --no-run.
  • Affected-crate Clippy and repository hooks pass.

Local runtime validation is limited to the focused snippet and canonical tests above. Broad Rust test targets were compile-checked, not executed.

Reference: CPython 3.14 parse_abbr.

AI assistance

OpenAI Codex assisted with auditing the split, implementation, regression coverage, and validation. The runtime does not expose an exact model identifier.

Summary by CodeRabbit

  • Bug Fixes
    • Time zone rules with empty abbreviations enclosed in angle brackets now raise a ValueError instead of being accepted as empty names.

Split the Python 3.14-compatible parser guard from RustPython#8954. Cover empty standard and daylight-saving abbreviations and preserve valid quoted names.

Assisted-by: OpenAI Codex:model identifier unavailable
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2d1e53f3-81a5-418e-b585-f9e147d1e949

📥 Commits

Reviewing files that changed from the base of the PR and between f473bd6 and 1f6e983.


📒 Files selected for processing (1)
  • extra_tests/snippets/stdlib_zoneinfo.py

💤 Files with no reviewable changes (1)
  • extra_tests/snippets/stdlib_zoneinfo.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.



📝 Walkthrough

Walkthrough

The POSIX time-zone abbreviation parser now rejects empty angle-bracket abbreviations. Tests verify that empty abbreviations raise ValueError and that a quoted +05 abbreviation is accepted.

Changes

Time-zone abbreviation parsing

Layer / File(s) Summary
Validate POSIX abbreviations
crates/stdlib/src/_zoneinfo.rs, extra_tests/snippets/stdlib_zoneinfo.py
The parser rejects empty angle-bracket abbreviations. Tests load minimal TZif v3 data to verify rejection of empty abbreviations and acceptance of quoted +05.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: youknowone


Merge Risk: ⚪ Minimal · up to 1f6e9

The parser and tests cover the intended rejection without an identified regression. The change is ready to merge after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: rejecting empty quoted POSIX TZ abbreviations in _zoneinfo.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@youknowone
youknowone marked this pull request as ready for review October 9, 2026 11:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T11:57:56.670029Z f473bd6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to stdlib_zoneinfo.py

Rename the snippet as requested during review without changing test contents.

Assisted-by: OpenAI Codex:model identifier unavailable
@codspeed

codspeed Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:fix-zoneinfo-empty-abbreviations (1f6e983) with main (bd8fdb7)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@youknowone
youknowone merged commit 59b36dd into RustPython:main Oct 9, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants