Skip to content

gh-148663: Document that IllegalMonthError inherits from both ValueError and IndexError - #148664

Merged
StanFromIreland merged 4 commits into
python:mainfrom
EoinTrial:fix/calendar-illegalmontherror-docs
Apr 23, 2026
Merged

gh-148663: Document that IllegalMonthError inherits from both ValueError and IndexError#148664
StanFromIreland merged 4 commits into
python:mainfrom
EoinTrial:fix/calendar-illegalmontherror-docs

Conversation

@EoinTrial

@EoinTrialEoinTrial commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

The documentation for calendar.IllegalMonthError describes it only as "a subclass of ValueError", but the source code defines it as:

classIllegalMonthError(ValueError, IndexError):

The IndexError base class is intentional for backwards compatibility (see the source comment in Lib/calendar.py), but this is not mentioned in the docs. Users catching IndexError for bad month numbers won't know their code still works after Python 3.13.


📚 Documentation preview 📚: https://cpython-previews--148664.org.readthedocs.build/

@python-cla-bot

python-cla-botBot commented Apr 17, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@picnixz

Copy link
Copy Markdown
Member
  1. Can you add a versionchanged directive indicating that this is now inheriting ValuerError and IndexError since 3.13 (I did not check when it was changed so pick the correct version).
  2. Reword the NEWS entry
  3. Add a test to ensure that we do not remove that double inheritance.

@EoinTrial
EoinTrialforce-pushed the fix/calendar-illegalmontherror-docs branch from 58e98ba to 1781682CompareApril 19, 2026 14:32
@EoinTrial

Copy link
Copy Markdown
ContributorAuthor

@picnixz Thanks for taking a look! I've added the versionchanged:: 3.12 directive, rewritten the NEWS entry, and added test_illegal_month_error_bases to verify the dual inheritance.

Comment threadDoc/library/calendar.rst Outdated
Comment threadDoc/library/calendar.rst Outdated
Comment threadDoc/library/calendar.rst Outdated
Comment threadLib/test/test_calendar.py Outdated
@EoinTrial
EoinTrialforce-pushed the fix/calendar-illegalmontherror-docs branch from 1781682 to c4e2753CompareApril 19, 2026 16:46
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@EoinTrial
EoinTrial requested a review from picnixzApril 19, 2026 16:48
@EoinTrial

Copy link
Copy Markdown
ContributorAuthor

@picnixz Thanks very much for reviewing! What's the next step towards getting this merged? :)

@picnixz

Copy link
Copy Markdown
Member

I need to come back home so a week or so. In general, once it is approved by one core dev, if the change is minimal, it will be merged when they have time. On your side there is nothing to do (we will ourselves update the branch if necessary/

@picnixz

Copy link
Copy Markdown
Member

There are however some lint issues so could you fix them please?

Comment threadDoc/library/calendar.rst Outdated
Co-authored-by: Stan Ulbrych <stan@python.org>

@StanFromIrelandStanFromIreland left a comment

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.

LGTM

@StanFromIrelandStanFromIreland added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Apr 23, 2026
@StanFromIreland
StanFromIreland merged commit 435be06 into python:mainApr 23, 2026
51 checks passed
@github-project-automationgithub-project-automationBot moved this from Todo to Done in Docs PRsApr 23, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @EoinTrial for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@bedevere-app

Copy link
Copy Markdown

GH-148917 is a backport of this pull request to the 3.14 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.14 bugs and security fixes label Apr 23, 2026
@bedevere-app

Copy link
Copy Markdown

GH-148918 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.13 bugs and security fixes label Apr 23, 2026
@StanFromIreland

Copy link
Copy Markdown
Member

Merged, GRMA!

@EoinTrial
EoinTrial deleted the fix/calendar-illegalmontherror-docs branch April 23, 2026 16:41
@EoinTrial

Copy link
Copy Markdown
ContributorAuthor

@StanFromIreland Tá fáilte mhór romhat, a chara ;)

ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
…from both `ValueError` and `IndexError` (python#148664)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
StanFromIreland added a commit that referenced this pull request Apr 27, 2026
… from both `ValueError` and `IndexError` (GH-148664) (#148917)
(cherry picked from commit 435be06)
Co-authored-by: Eoin Shaughnessy <45000144+EoinTrial@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
StanFromIreland added a commit that referenced this pull request May 3, 2026
… from both `ValueError` and `IndexError` (GH-148664) (#148918)
(cherry picked from commit 435be06)
Co-authored-by: Eoin Shaughnessy <45000144+EoinTrial@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docsDocumentation in the Doc dir

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants

@EoinTrial@picnixz@StanFromIreland