summaryrefslogtreecommitdiff
path: root/debian/patches/0004-Normalise-year-info-to-be-within-Python-s-year-bound.patch
blob: 4cfccacc9429eea179c2244e3cc3a2fdd8dc0e0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)
 
 
--