-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No proper validation for month in Calendar Module #126476
Comments
I think it'd make sense to raise |
…ethod when the input month is not corret
@Zheaoli Also add the validation for arguments, right after get options. Because the same issue happening for cli. if options.month is not None and options.month not in range(1, 13):
parser.error(IllegalMonthError(options.month).__str__())
sys.exit(1) |
Yes, but @Zheaoli already did it. |
@Zheaoli For future reference, it's a good idea to let an issue author send a PR if asked, especially for first time contributors. |
…e input month is not correct (GH-126484) Co-authored-by: Ethan Furman <[email protected]>
…hen the input month is not correct (pythonGH-126484) (cherry picked from commit 3be7498) Co-authored-by: Nadeshiko Manju <[email protected]> Co-authored-by: Ethan Furman <[email protected]>
…hen the input month is not correct (pythonGH-126484) (cherry picked from commit 3be7498) Co-authored-by: Nadeshiko Manju <[email protected]> Co-authored-by: Ethan Furman <[email protected]>
…when the input month is not correct (GH-126484) (GH-126878) gh-126476: Raise IllegalMonthError for calendar.formatmonth() when the input month is not correct (GH-126484) (cherry picked from commit 3be7498) Co-authored-by: Nadeshiko Manju <[email protected]> Co-authored-by: Ethan Furman <[email protected]>
…when the input month is not correct (GH-126484) (GH-126879) gh-126476: Raise IllegalMonthError for calendar.formatmonth() when the input month is not correct (GH-126484) (cherry picked from commit 3be7498) Co-authored-by: Nadeshiko Manju <[email protected]> Co-authored-by: Ethan Furman <[email protected]>
Bug report
Bug description:
In the calendar module,
IllegalMonthError
is not handled properly. For months greater than 12, an IndexError is raised instead.formatmonthname
do not raise IndexError for negative integer because list support negative integer indexing.CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
IllegalMonthError
for calendar.formatmonth method when the input month is not corret #126484The text was updated successfully, but these errors were encountered: