diff -r fac5562ae9c6 Lib/copy.py --- a/Lib/copy.py Mon Nov 23 22:19:12 2015 -0800 +++ b/Lib/copy.py Tue Nov 24 18:33:47 2015 +0200 @@ -279,7 +279,7 @@ def _reconstruct(x, info, deep, memo=Non if n > 2: state = info[2] else: - state = {} + state = None if n > 3: listiter = info[3] else: @@ -293,7 +293,7 @@ def _reconstruct(x, info, deep, memo=Non y = callable(*args) memo[id(x)] = y - if state: + if state is not None: if deep: state = deepcopy(state, memo) if hasattr(y, '__setstate__'): diff -r fac5562ae9c6 Lib/test/test_copy.py --- a/Lib/test/test_copy.py Mon Nov 23 22:19:12 2015 -0800 +++ b/Lib/test/test_copy.py Tue Nov 24 18:33:47 2015 +0200 @@ -213,6 +213,9 @@ class TestCopy(unittest.TestCase): return self.foo == other.foo x = C(42) self.assertEqual(copy.copy(x), x) + # State with boolean value is False (issue #25718) + x = C(0.0) + self.assertEqual(copy.copy(x), x) # The deepcopy() method @@ -517,6 +520,12 @@ class TestCopy(unittest.TestCase): self.assertEqual(y, x) self.assertIsNot(y, x) self.assertIsNot(y.foo, x.foo) + # State with boolean value is False (issue #25718) + x = C([]) + y = copy.deepcopy(x) + self.assertEqual(y, x) + self.assertIsNot(y, x) + self.assertIsNot(y.foo, x.foo) def test_deepcopy_reflexive_inst(self): class C: diff -r fac5562ae9c6 Misc/NEWS --- a/Misc/NEWS Mon Nov 23 22:19:12 2015 -0800 +++ b/Misc/NEWS Tue Nov 24 18:33:47 2015 +0200 @@ -95,6 +95,8 @@ Core and Builtins Library ------- +- Issue #25718: Fixed copying object with state with boolean value is False. + - Issue #25663: In the Readline completer, avoid listing duplicate global names, and search the global namespace before searching builtins.