[issue22416] Pickling compiled re patterns

Guido van Rossum report at bugs.python.org
Mon Sep 15 19:25:14 CEST 2014


Guido van Rossum added the comment:

But who says this isn't intended? I don't know why it was done this way, but the following reasoning might apply: we want to have a stable API for unpickling compiled regexps, but we want to be able to evolve the re.compile() API. Just the fact that '_compile' starts with an underscore doesn't mean that it may involve -- in fact, the fact that it is used by pickles says the opposite. Therefore I think the patch makes things worse (tying the pickle format to the public re.compile() method).

At best we should add a comment to _compile explaining that its API is constrained by pickle backward compatibility.

----------
nosy: +gvanrossum
resolution:  -> not a bug
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22416>
_______________________________________


More information about the Python-bugs-list mailing list