diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-03-31 20:23:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-31 20:23:49 (GMT) |
commit | 7d5d13d8d003ae5b62bb8c9ef1d1f310eaabc506 (patch) | |
tree | 0351bc800a0436804e45c36120d79b26578c9ff6 /Lib/test | |
parent | 0a17e584461b14ff65ec287048f53911dbb22222 (diff) | |
download | cpython-7d5d13d8d003ae5b62bb8c9ef1d1f310eaabc506.zip cpython-7d5d13d8d003ae5b62bb8c9ef1d1f310eaabc506.tar.gz cpython-7d5d13d8d003ae5b62bb8c9ef1d1f310eaabc506.tar.bz2 |
bpo-29953: Fix memory leaks in the replace() method of datetime and t… (#933)
objects when pass out of bound fold argument.
(cherry picked from commit 314d6fca36a4eaa0541218431d14804fadec6488)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/datetimetester.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index 2350125..bccd97a 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -4313,6 +4313,11 @@ class TestLocalTimeDisambiguation(unittest.TestCase): dt = dt.replace(fold=1, tzinfo=Eastern) self.assertEqual(t.replace(tzinfo=None).fold, 1) self.assertEqual(dt.replace(tzinfo=None).fold, 1) + # Out of bounds. + with self.assertRaises(ValueError): + t.replace(fold=2) + with self.assertRaises(ValueError): + dt.replace(fold=2) # Check that fold is a keyword-only argument with self.assertRaises(TypeError): t.replace(1, 1, 1, None, 1) |