[issue10073] calendar.isleap() not checking parameter type
Retro
report at bugs.python.org
Sun Oct 17 00:21:37 CEST 2010
Retro <vinetouu at gmail.com> added the comment:
I would just add an exception to the isleap() function.
def isleap(year):
"""Return 1 for leap years, 0 for non-leap years."""
try:
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
except TypeError:
# somehow inform the user that the argument 'year' must be an integer
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10073>
_______________________________________
More information about the Python-bugs-list
mailing list