[issue38293] Deepcopying property objects results in unexpected TypeError

2020-01-12 Thread miss-islington


miss-islington  added the comment:


New changeset 3043ec7d6aed402218404c25179e734166c7fbe0 by Miss Islington (bot) 
in branch '3.8':
bpo-38293: Allow shallow and deep copying of property objects (GH-16438)
https://github.com/python/cpython/commit/3043ec7d6aed402218404c25179e734166c7fbe0


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2020-01-12 Thread miss-islington


miss-islington  added the comment:


New changeset 4be97260351f214d3c8b8477682323bb52ee2af3 by Miss Islington (bot) 
in branch '3.7':
bpo-38293: Allow shallow and deep copying of property objects (GH-16438)
https://github.com/python/cpython/commit/4be97260351f214d3c8b8477682323bb52ee2af3


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2020-01-12 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17377
pull_request: https://github.com/python/cpython/pull/17969

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2020-01-12 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2020-01-12 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17376
pull_request: https://github.com/python/cpython/pull/17968

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2020-01-12 Thread miss-islington

miss-islington  added the comment:


New changeset 9f3fc6c5b4993f2b362263b494f84793a21aa073 by Miss Islington (bot) 
(Guðni Natan Gunnarsson) in branch 'master':
bpo-38293: Allow shallow and deep copying of property objects (GH-16438)
https://github.com/python/cpython/commit/9f3fc6c5b4993f2b362263b494f84793a21aa073


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2019-09-27 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

I can confirm this behavior also on python 3.6 3.8 3.9

--
versions: +Python 3.6, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2019-09-27 Thread Emmanuel Arias


Change by Emmanuel Arias :


--
nosy: +eamanu

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2019-09-27 Thread Guðni Nathan

Change by Guðni Nathan :


--
keywords: +patch
pull_requests: +16016
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/16438

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2019-09-27 Thread Guðni Nathan

Guðni Nathan  added the comment:

This bug appears to also affect shallow copies and can be reproduced with the 
following code:

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

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2019-09-27 Thread Guðni Nathan

Guðni Nathan  added the comment:

Function objects are considered "atomic" here and I believe you can also write 
to their __doc__ (among other attributes).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2019-09-27 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

But the property object is not atomic. It's attribute __doc__ is writeable.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2019-09-27 Thread Guðni Nathan

Guðni Nathan  added the comment:

A small change:

The fix should go to Lib/copy.py:198, not line 208.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38293] Deepcopying property objects results in unexpected TypeError

2019-09-27 Thread Guðni Nathan

New submission from Guðni Nathan :

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 "", line 1, in 
  File "C:\Program 
Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1264.0_x64__qbz5n2kfra8p0\lib\copy.py",
 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/copy.py after line 208:

d[property] = _deepcopy_atomic

Means that property objects will be treated as atomic, and therefore returned 
as-is.

--
components: Library (Lib)
messages: 353375
nosy: Guðni Nathan
priority: normal
severity: normal
status: open
title: Deepcopying property objects results in unexpected TypeError
type: behavior
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com