Message258921
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. |
|
Date |
User |
Action |
Args |
2016-01-25 20:53:06 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, fdrake, vstinner, alexandre.vassalotti |
2016-01-25 20:53:06 | serhiy.storchaka | set | messageid: <1453755186.26.0.578500471201.issue26202@psf.upfronthosting.co.za> |
2016-01-25 20:53:06 | serhiy.storchaka | link | issue26202 messages |
2016-01-25 20:53:06 | serhiy.storchaka | create | |
|