[Python-bugs-list] [ python-Feature Requests-416670 ] MatchObjects not deepcopy()able
SourceForge.net
noreply@sourceforge.net
Mon, 12 May 2003 16:14:25 -0700
Feature Requests item #416670, was opened at 2001-04-17 05:31
Message generated for change (Comment added) made by bcannon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=416670&group_id=5470
Category: Regular Expressions
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Henning Thielemann (amigalemming)
Assigned to: Fredrik Lundh (effbot)
Summary: MatchObjects not deepcopy()able
Initial Comment:
In the re-Module which come with Python version 2.0
(Nov 28 11:10 re.py) the created MatchObjects cannot be
copied with a deepcopy(). Switching back to the old
"pre.py" as proposed in "re.py" makes everything work
ok.
----------------------------------------------------------------------
>Comment By: Brett Cannon (bcannon)
Date: 2003-05-12 16:14
Message:
Logged In: YES
user_id=357491
The patch by Martin referenced below was closed since, as Fredrik pointed
out in the patch, that re objects have __copy__ and __deepcopy__ methods.
Problem is that they are untested so they are basically no-ops after
compilation by raising exceptions. So if this feature is still desired someone
just needs to work the kinks out of what Fredrik has started.
----------------------------------------------------------------------
Comment By: Fredrik Lundh (effbot)
Date: 2001-04-28 01:53
Message:
Logged In: YES
user_id=38376
On the other hand, it looks like we've found a rather
elegant way to solve this. I'll leave this one open
(as a feature request).
----------------------------------------------------------------------
Comment By: Henning Thielemann (amigalemming)
Date: 2001-04-27 03:03
Message:
Logged In: YES
user_id=197994
You are right, m.groupdict() and m.groups() are surely the
better choice.
----------------------------------------------------------------------
Comment By: Fredrik Lundh (effbot)
Date: 2001-04-26 14:50
Message:
Logged In: YES
user_id=38376
I'm not sure this is a bug -- imo, you're relying on
an implementation artifact in the original PCRE port.
And making this work under SRE isn't as easy as it may
appear (the proposed patch may work in your specific
case, but it isn't a general solution).
But before I make up my mind here, maybe you could tell
me why you think it's a good idea to use deepcopy on
match objects. Why not just store "m.groups()" or
"m.regs" instead?
Cheers /F
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2001-04-26 01:01
Message:
Logged In: YES
user_id=21627
A patch for that problem is in
http://sourceforge.net/tracker/index.php?func=detail&aid=419070&group_id=5470&atid=305470
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=416670&group_id=5470