diff -r 6db40a9955dc Lib/copy.py --- a/Lib/copy.py Sun Jan 24 22:15:20 2016 -0800 +++ b/Lib/copy.py Mon Jan 25 22:45:16 2016 +0200 @@ -207,7 +207,6 @@ try: except AttributeError: pass d[type] = _deepcopy_atomic -d[range] = _deepcopy_atomic d[types.BuiltinFunctionType] = _deepcopy_atomic d[types.FunctionType] = _deepcopy_atomic d[weakref.ref] = _deepcopy_atomic diff -r 6db40a9955dc Lib/test/test_copy.py --- a/Lib/test/test_copy.py Sun Jan 24 22:15:20 2016 -0800 +++ b/Lib/test/test_copy.py Mon Jan 25 22:45:16 2016 +0200 @@ -314,7 +314,7 @@ class TestCopy(unittest.TestCase): pass tests = [None, 42, 2**100, 3.14, True, False, 1j, "hello", "hello\u1234", f.__code__, - NewStyle, range(10), Classic, max] + NewStyle, Classic, max] for x in tests: self.assertIs(copy.deepcopy(x), x) @@ -536,6 +536,17 @@ class TestCopy(unittest.TestCase): self.assertIsNot(y, x) self.assertIs(y.foo, y) + def test_deepcopy_range(self): + class I(int): + pass + x = range(I(10)) + y = copy.deepcopy(x) + self.assertIsNot(y, x) + self.assertEqual(y, x) + self.assertIsNot(y.stop, x.stop) + self.assertEqual(y.stop, x.stop) + self.assertIsInstance(y.stop, I) + # _reconstruct() def test_reconstruct_string(self):