diff options
author | Fredrik Lundh <fredrik@pythonware.com> | 2002-06-27 19:59:27 (GMT) |
---|---|---|
committer | Fredrik Lundh <fredrik@pythonware.com> | 2002-06-27 19:59:27 (GMT) |
commit | 6f7c3431c80b93d0b82e1d1a2d087192f9f9c590 (patch) | |
tree | 254a3b4bc2f86fa37fc757b6062df4db151872ec /Lib | |
parent | 1add023b882273f928955df8f4a917952a89d910 (diff) | |
download | cpython-6f7c3431c80b93d0b82e1d1a2d087192f9f9c590.zip cpython-6f7c3431c80b93d0b82e1d1a2d087192f9f9c590.tar.gz cpython-6f7c3431c80b93d0b82e1d1a2d087192f9f9c590.tar.bz2 |
Fix bug #570057: Broken pre.subn() (and pre.sub())
This should be backported to the 2.2.X series (how
do I do that?)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/pre.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -367,10 +367,12 @@ class RegexObject: end = len(source) if type(repl) is type(''): - # See if repl contains group references + # See if repl contains group references (if it does, + # pcre_expand will attempt to call _Dummy.group, which + # results in a TypeError) try: repl = pcre_expand(_Dummy, repl) - except error: + except (error, TypeError): m = MatchObject(self, source, 0, end, []) repl = lambda m, repl=repl, expand=pcre_expand: expand(m, repl) else: |