summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-03-31 19:48:16 (GMT)
committerGitHub <noreply@github.com>2017-03-31 19:48:16 (GMT)
commit314d6fca36a4eaa0541218431d14804fadec6488 (patch)
tree0e36bdd257a06afec8a8d9ecd791bd12f69158ec /Lib
parent06bb4873d6a9ac303701d08a851d6cd9a51e02a3 (diff)
downloadcpython-314d6fca36a4eaa0541218431d14804fadec6488.zip
cpython-314d6fca36a4eaa0541218431d14804fadec6488.tar.gz
cpython-314d6fca36a4eaa0541218431d14804fadec6488.tar.bz2
bpo-29953: Fix memory leaks in the replace() method of datetime and time (#927)
objects when pass out of bound fold argument.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/datetimetester.py5
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)