[Python-Dev] Python2.5 _sre deepcopy regression? (original) (raw)
Andrew McNamara andrewm at object-craft.com.au
Tue Nov 4 02:32:28 CET 2008
- Previous message: [Python-Dev] XXX do we need a new policy?
- Next message: [Python-Dev] DVCS PEP update
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I posted this week ago, but haven't seen any comments. Issue 416670 is probably the most relevent ticket.
The buggy changeset I mention, 38430 on the release24-maint branch is one that had been forward and back-ported for a while. I haven't found the motivation for that change, but it hasn't been applied to any version of Python later than 2.4.
In version of Python prior to 2.5, it would appear that deepcopying compiled regular expressions worked by accident: >2.4: > >>> copy.deepcopy(re.compile('')) <sre.SREPattern object at 0xb7d53ef0> >2.5: > >>> copy.deepcopy(re.compile('')) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.5/copy.py", line 173, in deepcopy y = copier(memo) TypeError: cannot deepcopy this pattern object >I say "by accident", since the SREPattern object in 2.4 has a deepcopy method which raises the "cannot deepcopy this pattern object" TypeError, however this method isn't found by copy.deepcopy() in 2.4, and copy.deepcopy() falls back to using the pickle logic. >The sre source has #ifdef-out support for deepcopy, issue 416670 has the gory details: > http://bugs.python.org/issue416670 >Changeset 38430 on the release24-maint branch introduced the changes that stopped SREPattern.deepcopy being found. r38430 was a patch forward ported from 2.3, but never ported to the trunk (probably a good thing, too). >Thoughts?
Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/
- Previous message: [Python-Dev] XXX do we need a new policy?
- Next message: [Python-Dev] DVCS PEP update
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]