python-vobject (0.8.1c-4) 0004-Normalise-year-info-to-be-within-Python-s-year-bound.patch

Summary

 vobject/icalendar.py |    5 +++++
 1 file changed, 5 insertions(+)

    
download this patch

Patch contents

From: Dave Holland <dave@debian.org>
Date: Wed, 1 Jun 2011 19:58:27 +0200
Subject: Normalise year info to be within Python's year bounds.

Closes: #574133
---
 vobject/icalendar.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/vobject/icalendar.py b/vobject/icalendar.py
index b960deb..79ea7af 100644
--- a/vobject/icalendar.py
+++ b/vobject/icalendar.py
@@ -1617,6 +1617,11 @@ def stringToDateTime(s, tzinfo=None):
                 tzinfo = utc
     except:
         raise ParseError("'%s' is not a valid DATE-TIME" % s)
+    if year < datetime.MINYEAR:
+        year = datetime.MINYEAR
+    if year > datetime.MAXYEAR:
+        year = datetime.MAXYEAR
+
     return datetime.datetime(year, month, day, hour, minute, second, 0, tzinfo)
 
 
--