mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-29953: Fix memory leaks in the replace() method of datetime and time (#927)
objects when pass out of bound fold argument.
This commit is contained in:
parent
06bb4873d6
commit
314d6fca36
3 changed files with 18 additions and 11 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue