[New-bugs-announce] [issue10073] calendar.isleap() not checking parameter type

AM Helin report at bugs.python.org
Tue Oct 12 15:47:56 CEST 2010

New submission from AM Helin <shadikka at gmail.com>:

calendar.isleap() doesn't enforce any types, leading to string formatting errors when a string is passed to it:

>>> calendar.isleap("2011")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/calendar.py", line 99, in isleap
    return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
TypeError: not all arguments converted during string formatting

A quick peek at the SVN shows that the problem still exists.

components: Library (Lib)
messages: 118424
nosy: shadikka
priority: normal
severity: normal
status: open
title: calendar.isleap() not checking parameter type
versions: Python 2.7, Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list