[issue11957] re.sub confusion between count and flags args

Serhiy Storchaka report at bugs.python.org
Wed Oct 29 20:49:46 CET 2014


Serhiy Storchaka added the comment:

Thank you for your patch Valentina. But it makes flags combinations not pickleable.

>>> import re, pickle
>>> pickle.dumps(re.I|re.S, 3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
_pickle.PicklingError: Can't pickle <enum 'SubFlag'>: attribute lookup SubFlag on sre_constants failed
>>> pickle.dumps(re.I|re.S, 4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
_pickle.PicklingError: Can't pickle <enum 'SubFlag'>: attribute lookup BaseFlags.__or__.<locals>.SubFlag on sre_constants failed

And I'm afraid that creating new class in the "|" operator can affect performance.

----------
versions: +Python 3.5 -Python 2.7, Python 3.3, Python 3.4

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


More information about the Python-bugs-list mailing list