STINNER Victor added the comment:
Hi Cédric!
while True:
yield date
- date += oneday
+ try:
+ date += oneday
+ except OverflowError:
+ break
You might add a comment explaining why we may get an OverflowError here.
I don't know the cost of adding a try/except in a loop. But the loop has 31
iterations or less, so it's maybe better to keep the explicit try/except around
date += oneday.
+ def test_itermonthdates(self):
+ # ensure itermonthdates works for all months
+ list(calendar.Calendar().itermonthdates(9999, 12))
Please use datetime.MAXYEAR instead of this hardcoded constant.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15421>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com