changeset: 89416:b3fb7828b6fc branch: 3.3 parent: 89407:8afcfe6dfd6e user: Antoine Pitrou date: Thu Feb 27 22:14:31 2014 +0100 files: Lib/copy.py Lib/test/test_copy.py Misc/NEWS description: Issue #20791: copy.copy() now doesn't make a copy when the input is a bytes object. Initial patch by Peter Otten. diff -r 8afcfe6dfd6e -r b3fb7828b6fc Lib/copy.py --- a/Lib/copy.py Thu Feb 27 13:49:34 2014 -0500 +++ b/Lib/copy.py Thu Feb 27 22:14:31 2014 +0100 @@ -110,7 +110,7 @@ def _copy_immutable(x): return x for t in (type(None), int, float, bool, str, tuple, - frozenset, type, range, + bytes, frozenset, type, range, types.BuiltinFunctionType, type(Ellipsis), types.FunctionType, weakref.ref): d[t] = _copy_immutable diff -r 8afcfe6dfd6e -r b3fb7828b6fc Lib/test/test_copy.py --- a/Lib/test/test_copy.py Thu Feb 27 13:49:34 2014 -0500 +++ b/Lib/test/test_copy.py Thu Feb 27 22:14:31 2014 +0100 @@ -98,6 +98,7 @@ pass tests = [None, 42, 2**100, 3.14, True, False, 1j, "hello", "hello\u1234", f.__code__, + b"world", bytes(range(256)), NewStyle, range(10), Classic, max, WithMetaclass] for x in tests: self.assertIs(copy.copy(x), x) diff -r 8afcfe6dfd6e -r b3fb7828b6fc Misc/NEWS --- a/Misc/NEWS Thu Feb 27 13:49:34 2014 -0500 +++ b/Misc/NEWS Thu Feb 27 22:14:31 2014 +0100 @@ -26,6 +26,9 @@ Library ------- +- Issue #20791: copy.copy() now doesn't make a copy when the input is + a bytes object. Initial patch by Peter Otten. + - Issue #20621: Fixes a zipimport bug introduced in 3.3.4 that could cause spurious crashes or SystemErrors when importing modules or packages from a zip file. The change causing the problem was reverted.