Skip to content

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

Merged
StanFromIreland merged 4 commits intopython: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 intopython:mainfrom
EoinTrial:fix/calendar-illegalmontherror-docs

Conversation

@EoinTrial
Copy link
Copy Markdown

@EoinTrial EoinTrial commented Apr 17, 2026

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

class IllegalMonthError(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
Copy link
Copy Markdown

python-cla-bot Bot commented Apr 17, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@picnixz
Copy link
Copy Markdown
Member

picnixz commented Apr 19, 2026

  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 EoinTrial force-pushed the fix/calendar-illegalmontherror-docs branch from 58e98ba to 1781682 Compare April 19, 2026 14:32
@EoinTrial EoinTrial requested a review from AA-Turner as a code owner April 19, 2026 14:32
@EoinTrial
Copy link
Copy Markdown
Author

@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 thread Doc/library/calendar.rst Outdated
Comment thread Doc/library/calendar.rst Outdated
Comment thread Doc/library/calendar.rst Outdated
Comment thread Lib/test/test_calendar.py Outdated
@EoinTrial EoinTrial force-pushed the fix/calendar-illegalmontherror-docs branch from 1781682 to c4e2753 Compare April 19, 2026 16:46
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@EoinTrial EoinTrial requested a review from picnixz April 19, 2026 16:48
@EoinTrial
Copy link
Copy Markdown
Author

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

@picnixz
Copy link
Copy Markdown
Member

picnixz commented Apr 21, 2026

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

picnixz commented Apr 21, 2026

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

Comment thread Doc/library/calendar.rst Outdated
Co-authored-by: Stan Ulbrych <stan@python.org>
Copy link
Copy Markdown
Member

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

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

LGTM

@StanFromIreland StanFromIreland 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:main Apr 23, 2026
51 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Apr 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

bedevere-app Bot commented Apr 23, 2026

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Apr 23, 2026
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented Apr 23, 2026

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

@bedevere-app bedevere-app Bot 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
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants