Created
December 19, 2016 00:21
-
-
Save kevinseelbach/9464be3a623619531a915f09cce2c800 to your computer and use it in GitHub Desktop.
Inconsistent copy.deepcopy across Python 2.7 / 3.5 versions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Python 3.5.2 (default, Dec 17 2016, 20:19:49) | |
| [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> import threading | |
| >>> import copy | |
| >>> x = threading.local() | |
| >>> x.a = 1 | |
| >>> y = copy.deepcopy(x) | |
| >>> y.a | |
| Traceback (most recent call last): | |
| File "<stdin>", line 1, in <module> | |
| AttributeError: '_thread._local' object has no attribute 'a' | |
| Python 2.7.13 (default, Dec 17 2016, 20:15:44) | |
| [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> import threading | |
| >>> import copy | |
| >>> x = threading.local() | |
| >>> x.a = 1 | |
| >>> y = copy.deepcopy(x) | |
| >>> y.a | |
| 1 | |
| >>> | |
| """ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment