This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients belopolsky, ced, ezio.melotti, rhettinger, skip.montanaro, terry.reedy, vstinner
Date 2012-09-20.21:43:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.
Date User Action Args
2012-09-20 21:43:10vstinnersetrecipients: + vstinner, skip.montanaro, rhettinger, terry.reedy, belopolsky, ezio.melotti, ced
2012-09-20 21:43:10vstinnersetmessageid: <>
2012-09-20 21:43:10vstinnerlinkissue15421 messages
2012-09-20 21:43:09vstinnercreate