Staging
v0.8.1
https://github.com/python/cpython
Revision 9f3fc6c5b4993f2b362263b494f84793a21aa073 authored by Guðni Natan Gunnarsson on 12 January 2020, 17:41:49 UTC, committed by Miss Islington (bot) on 12 January 2020, 17:41:49 UTC


Copying property objects results in a TypeError. Steps to reproduce:

```
>>> import copy
>>> obj = property()
>>> copy.copy(obj)
````

This affects both shallow and deep copying.  
My idea for a fix is to add property objects to the list of "atomic" objects in the copy module.
These already include types like functions and type objects.

I also added property objects to the unit tests test_copy_atomic and test_deepcopy_atomic. This is my first PR, and it's highly likely I've made some mistake, so please be kind :)


https://bugs.python.org/issue38293
1 parent 54cfbb2
History
Tip revision: 9f3fc6c5b4993f2b362263b494f84793a21aa073 authored by Guðni Natan Gunnarsson on 12 January 2020, 17:41:49 UTC
bpo-38293: Allow shallow and deep copying of property objects (GH-16438)
Tip revision: 9f3fc6c
File Mode Size
pgen
Python.asdl -rw-r--r-- 5.3 KB
acceler.c -rw-r--r-- 3.3 KB
asdl.py -rw-r--r-- 12.6 KB
asdl_c.py -rwxr-xr-x 46.5 KB
grammar1.c -rw-r--r-- 1.0 KB
listnode.c -rw-r--r-- 1.6 KB
myreadline.c -rw-r--r-- 10.6 KB
node.c -rw-r--r-- 5.1 KB
parser.c -rw-r--r-- 12.4 KB
parser.h -rw-r--r-- 1.4 KB
parsetok.c -rw-r--r-- 14.2 KB
token.c -rw-r--r-- 4.5 KB
tokenizer.c -rw-r--r-- 55.1 KB
tokenizer.h -rw-r--r-- 3.7 KB

back to top