Skip to content

Commit 55392a0

Browse files
author
Richard Jones
committed
deepcopy was broken for date stuff
1 parent e58ab45 commit 55392a0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

roundup/date.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: date.py,v 1.69 2004-05-19 17:12:18 a1s Exp $
18+
# $Id: date.py,v 1.70 2004-05-23 10:23:28 richard Exp $
1919

2020
"""Date, time and time interval handling.
2121
"""
@@ -370,6 +370,10 @@ def local(self, offset):
370370
return Date((self.year, self.month, self.day, self.hour + offset,
371371
self.minute, self.second, 0, 0, 0))
372372

373+
def __deepcopy__(self, memo):
374+
return Date((self.year, self.month, self.day, self.hour,
375+
self.minute, self.second, 0, 0, 0))
376+
373377
def get_tuple(self):
374378
return (self.year, self.month, self.day, self.hour, self.minute,
375379
self.second, 0, 0, 0)
@@ -460,6 +464,10 @@ def __init__(self, spec, sign=1, allowdate=1, add_granularity=0,
460464
self.second = spec
461465
self.second = int(self.second)
462466

467+
def __deepcopy__(self, memo):
468+
return Interval((self.sign, self.year, self.month, self.day,
469+
self.hour, self.minute, self.second))
470+
463471
def set(self, spec, allowdate=1, interval_re=re.compile('''
464472
\s*(?P<s>[-+])? # + or -
465473
\s*((?P<y>\d+\s*)y)? # year

0 commit comments

Comments
 (0)