A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-June/004726.html below:

[Python-Dev] Turning on sre?

[Python-Dev] Turning on sre?Guido van Rossum guido@python.org
Sun, 18 Jun 2000 15:47:22 -0500
> Before 1.6a3, should the sre module be turned on, replacing re?  That
> way it'll start getting tested; better we find problems sooner rather
> than later...

That would be nice.  If I replace re.py with "from sre import *" and
run test_re.py, I grt in trouble in the sub() test:

$ ./python ../Lib/test/test_re.py
Running tests on re.search and re.match
Running tests on re.sub
Traceback (most recent call last):
  File "../Lib/test/test_re.py", line 41, in ?
    assert re.sub(r'\d+', bump_num, '08.2 -2 23x99y') == '9.3 -3 24x100y'
  File "./../Lib/sre.py", line 35, in sub
    return _compile(pattern).sub(repl, string, count)
  File "./../Lib/sre.py", line 84, in _sub
    return _subn(pattern, template, string, count)[0]
  File "./../Lib/sre.py", line 114, in _subn
    return string[:0].join(s), n
TypeError: sequence item 0 not a string
$

It appears that the value of s is a list containing alternating zeros
and strings: [0, '.', 0, ' -', 0, ' ', 0, 'x', 0, 'y'].

No time to look into this further, but it could be a bug in sre._subn().

--Guido van Rossum (home page: http://www.python.org/~guido/)



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4