[issue18468] re.group() should never return a bytearray
Matthew Barnett
report at bugs.python.org
Thu Jul 18 15:33:39 CEST 2013
Matthew Barnett added the comment:
There's also the fact that the match object keeps a reference to the target string anyway:
>>> import re
>>> t = memoryview(b"a")
>>> t
<memory at 0x0100F110>
>>> m = re.match(b"a", t)
>>> m.string
<memory at 0x0100F110>
On that subject, buried in the source code (_sre.c) is the comment:
"""
/* FIXME: implement setattr("string", None) as a special case (to
detach the associated string, if any */
"""
In the regex module I added a method "detach_string" to perform that function.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18468>
_______________________________________
More information about the Python-bugs-list
mailing list