diff options
author | Anthon van der Neut <anthon@mnt.org> | 2017-01-18 09:32:22 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2017-01-18 09:32:22 +0100 |
commit | 87a5ef4574e4cb666ab0752e729693ad1ab3d782 (patch) | |
tree | 89e81d64b84c355f4e1c912e6beb76a44315a3e9 /timestamp.py | |
parent | f6fe5bcac3694c10e3300875398b1f94873dd091 (diff) | |
download | ruamel.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.py | 7 |
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 |