Skip to content

fix: preserve original skeleton in KeyError when fuzzy format_skeleton finds no match - #1275

Merged
akx merged 1 commit into
python-babel:masterfrom
SAY-5:fix/format-skeleton-keyerror-none
Oct 30, 2026
Merged

akx merged 1 commit into
python-babel:masterfrom
SAY-5:fix/format-skeleton-keyerror-none

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

When format_skeleton is called with fuzzy=True and match_skeleton finds no close match, it returns None. The subsequent locale.datetime_skeletons[skeleton] lookup then raises KeyError: None, which is confusing since it hides the skeleton that was actually requested.

This change falls back to the original skeleton when match_skeleton returns None, so the error is KeyError: 'G' instead of KeyError: None, consistent with the fuzzy=False behavior.

…n finds no match

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@akx
akx force-pushed the fix/format-skeleton-keyerror-none branch from 98e415b to 6dbe0f0 Compare October 30, 2026 11:20
@akx
akx enabled auto-merge (squash) October 30, 2026 11:21
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.56%. Comparing base (419a228) to head (6dbe0f0).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1275   +/-   ##
=======================================
  Coverage   93.56%   93.56%           
=======================================
  Files          27       27           
  Lines        4939     4939           
=======================================
  Hits         4621     4621           
  Misses        318      318           
Flag Coverage Δ
macos-14-3.10 92.65% <100.00%> (ø)
macos-14-3.11 92.58% <100.00%> (ø)
macos-14-3.12 92.79% <100.00%> (ø)
macos-14-3.13 92.79% <100.00%> (ø)
macos-14-3.14 92.77% <100.00%> (ø)
macos-14-3.15 92.77% <100.00%> (ø)
macos-14-3.8 92.52% <100.00%> (ø)
macos-14-3.9 92.58% <100.00%> (ø)
macos-14-pypy3.10 92.65% <100.00%> (ø)
ubuntu-24.04-3.10 92.67% <100.00%> (ø)
ubuntu-24.04-3.11 92.60% <100.00%> (ø)
ubuntu-24.04-3.12 92.81% <100.00%> (ø)
ubuntu-24.04-3.13 92.81% <100.00%> (ø)
ubuntu-24.04-3.14 92.79% <100.00%> (ø)
ubuntu-24.04-3.15 92.79% <100.00%> (ø)
ubuntu-24.04-3.8 92.54% <100.00%> (ø)
ubuntu-24.04-3.9 92.60% <100.00%> (ø)
ubuntu-24.04-pypy3.10 92.67% <100.00%> (ø)
windows-2022-3.10 92.66% <100.00%> (ø)
windows-2022-3.11 92.60% <100.00%> (ø)
windows-2022-3.12 92.80% <100.00%> (ø)
windows-2022-3.13 92.80% <100.00%> (ø)
windows-2022-3.14 92.78% <100.00%> (ø)
windows-2022-3.15 92.78% <100.00%> (ø)
windows-2022-3.8 92.63% <100.00%> (ø)
windows-2022-3.9 92.59% <100.00%> (ø)
windows-2022-pypy3.10 92.66% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed

codspeed Bot commented Oct 30, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 88 untouched benchmarks


Comparing SAY-5:fix/format-skeleton-keyerror-none (6dbe0f0) with master (419a228)

Open in CodSpeed

@akx
akx merged commit 61ece80 into python-babel:master Oct 30, 2026
36 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