Index: Lib/copy_reg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/copy_reg.py,v retrieving revision 1.3 diff -u -r1.3 copy_reg.py --- Lib/copy_reg.py 2000/02/02 15:10:13 1.3 +++ Lib/copy_reg.py 2000/06/27 19:33:00 @@ -12,10 +12,18 @@ def constructor(object): safe_constructors[object] = 1 -# Example: provide pickling support for complex numbers. +# pickling support for complex numbers. def pickle_complex(c): return complex, (c.real, c.imag) pickle(type(1j), pickle_complex, complex) +# pickling support for regular expressions + +import sre + +def pickle_sre(p): + return sre.compile, (p.pattern, p.flags) + +pickle(type(sre.compile("")), pickle_sre, sre.compile)