summaryrefslogtreecommitdiff
path: root/timestamp.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-01-18 09:32:22 +0100
committerAnthon van der Neut <anthon@mnt.org>2017-01-18 09:32:22 +0100
commit87a5ef4574e4cb666ab0752e729693ad1ab3d782 (patch)
tree89e81d64b84c355f4e1c912e6beb76a44315a3e9 /timestamp.py
parentf6fe5bcac3694c10e3300875398b1f94873dd091 (diff)
downloadruamel.yaml-87a5ef4574e4cb666ab0752e729693ad1ab3d782.tar.gz
fix deepcopy of TimeStamp, fix #91: crash if no compiler0.13.8
Diffstat (limited to 'timestamp.py')
-rw-r--r--timestamp.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/timestamp.py b/timestamp.py
index b0a535c..8b8715d 100644
--- a/timestamp.py
+++ b/timestamp.py
@@ -3,6 +3,7 @@
from __future__ import print_function, absolute_import, division, unicode_literals
import datetime
+import copy
class TimeStamp(datetime.datetime):
@@ -11,3 +12,9 @@ class TimeStamp(datetime.datetime):
def __new__(cls, *args, **kw): # datetime is immutable
return datetime.datetime.__new__(cls, *args, **kw)
+
+ def __deepcopy__(self, memo):
+ ts = TimeStamp(self.year, self.month, self.day,
+ self.hour, self.minute, self.second)
+ ts._yaml = copy.deepcopy(self._yaml)
+ return ts