This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author GudniNatan
Recipients GudniNatan
Date 2019-09-27.16:16:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Currently, attempting to deepcopy a property object will result in an unexpected TypeError:

>>> import copy
>>> obj = property()
>>> new_obj = copy.deepcopy(obj)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1264.0_x64__qbz5n2kfra8p0\lib\", line 169, in deepcopy
    rv = reductor(4)
TypeError: can't pickle property objects

What I believe is happening here is that since property objects are not treated by the copy module as atomic, they are passed off to be pickled and so our error is raised.
This can be fixed in a similar manner to how it works for type objects, function objects and more.
Adding a single line of code to Lib/ after line 208:

    d[property] = _deepcopy_atomic

Means that property objects will be treated as atomic, and therefore returned as-is.
Date User Action Args
2019-09-27 16:16:43GudniNatansetrecipients: + GudniNatan
2019-09-27 16:16:43GudniNatansetmessageid: <>
2019-09-27 16:16:43GudniNatanlinkissue38293 messages
2019-09-27 16:16:42GudniNatancreate