◐ Shell
clean mode source ↗

Message 230236 - Python tracker

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.