[issue26202] The range() object is deepcopied as atomic

2020-05-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This change has been reverted in issue40792. The range object attributes has 
now exact type int, so the original issue with deep copying is gone.

--

___
Python tracker 

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



[issue26202] The range() object is deepcopied as atomic

2020-05-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 5f4b229df7812f1788287095eb6b138bb21876a4 by Serhiy Storchaka in 
branch 'master':
bpo-40792: Make the result of PyNumber_Index() always having exact type int. 
(GH-20443)
https://github.com/python/cpython/commit/5f4b229df7812f1788287095eb6b138bb21876a4


--

___
Python tracker 

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



[issue26202] The range() object is deepcopied as atomic

2016-01-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Victor.

--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue26202] The range() object is deepcopied as atomic

2016-01-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5772eae17a82 by Serhiy Storchaka in branch '3.5':
Issue #26202: copy.deepcopy() now correctly copies range() objects with
https://hg.python.org/cpython/rev/5772eae17a82

New changeset d5d0b62c2830 by Serhiy Storchaka in branch 'default':
Issue #26202: copy.deepcopy() now correctly copies range() objects with
https://hg.python.org/cpython/rev/d5d0b62c2830

--
nosy: +python-dev

___
Python tracker 

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



[issue26202] The range() object is deepcopied as atomic

2016-01-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Returning the same range() object from copy.copy() is correct. This is shallow 
copying.

--

___
Python tracker 

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



[issue26202] The range() object is deepcopied as atomic

2016-01-25 Thread STINNER Victor

STINNER Victor added the comment:

deepcopy_range.patch looks good to me.

--

___
Python tracker 

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



[issue26202] The range() object is deepcopied as atomic

2016-01-25 Thread Ethan Furman

Ethan Furman added the comment:

I don't have much experience with the copy module, but I don't see any problems 
with the code.

Does copy.copy suffer from the same problem?  If yes, is it fixed with this 
same patch, or is more work needed?

--
nosy: +ethan.furman

___
Python tracker 

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



[issue26202] The range() object is deepcopied as atomic

2016-01-25 Thread Ethan Furman

Ethan Furman added the comment:

Victor, patch was already attached.  ;)

--

___
Python tracker 

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



[issue26202] The range() object is deepcopied as atomic

2016-01-25 Thread STINNER Victor

STINNER Victor added the comment:

Hum ok, it's a bug :-) It should be fixed. Do you want to work on a patch?

--

___
Python tracker 

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



[issue26202] The range() object is deepcopied as atomic

2016-01-25 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

The range() object is immutable, but is not atomic, and copy.deepcopy() 
shouldn't return it unchanged.

>>> class I(int): pass  # mutable index
... 
>>> import copy
>>> r = range(I(10))
>>> r2 = copy.deepcopy(r)
>>> r.stop.attr = 'spam'
>>> r2.stop.attr
'spam'

This is Python 3 only issue because in 2.7 the xrange() object doesn't exposes 
start/stop/step attributes.

Proposed patch fixes the copy module.

--
components: Library (Lib)
files: deepcopy_range.patch
keywords: patch
messages: 258921
nosy: alexandre.vassalotti, fdrake, haypo, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: The range() object is deepcopied as atomic
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41714/deepcopy_range.patch

___
Python tracker 

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