The functions pre.subn() and pre.sub() are broken in
Python2.2 and 2.2.1. The following test was done on
SunOS 5.6:
Python 2.2.1 (#1, Jun 13 2002, 12:57:34)
[GCC 2.95.2 19991024 (release)] on sunos5
Type "help", "copyright", "credits" or "license" for
more information.
>>> import re
>>> re.sub('(a)', '\g<1>', 'bab')
'bab'
>>> import pre as re
>>> re.sub('(a)', '\g<1>', 'bab')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/tools/lib/python2.2/pre.py", line
179, in sub
return pattern.sub(repl, string, count)
File "/usr/local/tools/lib/python2.2/pre.py", line
344, in sub
return self.subn(repl, string, count)[0]
File "/usr/local/tools/lib/python2.2/pre.py", line
366, in subn
repl = pcre_expand(_Dummy, repl)
TypeError: 'NoneType' object is not callable
The error has also been reproduced on SunOS5.7 with the
following interpreter:
Python 2.2 (#1, Dec 28 2001, 22:25:04)
[GCC 2.95.2 19991024 (release)] on sunos5
The error could not be reproduced on SunOS5.6 using
Python2.1.1:
Python 2.1.1 (#5, Sep 10 2001, 13:44:17)
[GCC 2.95.2 19991024 (release)] on sunos5
NOTE: The example for re.sub() in the Python Library
manual triggers this bug when used with module pre!
|