~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lazy_regex.py

  • Committer: Patch Queue Manager
  • Date: 2015-12-17 18:39:00 UTC
  • mfrom: (6606.1.2 fix-float)
  • Revision ID: pqm@pqm.ubuntu.com-20151217183900-0719du2uv1kwu3lc
(vila) Inline testtools private method to fix an issue in xenial (the
 private implementation has changed in an backward incompatible way).
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
be used by existing Python modules that create regexs.
25
25
"""
26
26
 
 
27
from __future__ import absolute_import
 
28
 
27
29
import re
28
30
 
29
31
from bzrlib import errors
71
73
            # cleaner message to the user.
72
74
            raise errors.InvalidPattern('"' + args[0] + '" ' +str(e))
73
75
 
 
76
    def __getstate__(self):
 
77
        """Return the state to use when pickling."""
 
78
        return {
 
79
            "args": self._regex_args,
 
80
            "kwargs": self._regex_kwargs,
 
81
            }
 
82
 
 
83
    def __setstate__(self, dict):
 
84
        """Restore from a pickled state."""
 
85
        self._real_regex = None
 
86
        setattr(self, "_regex_args", dict["args"])
 
87
        setattr(self, "_regex_kwargs", dict["kwargs"])
 
88
 
74
89
    def __getattr__(self, attr):
75
90
        """Return a member from the proxied regex object.
76
91