[Python-Dev] forwarded message from Guido van Rossum

Barry A. Warsaw barry@zope.com
Mon, 22 Oct 2001 01:36:38 -0400


With a cvs update, test_email.py fails because the behavior of
re.split() has changed, presumably due to /F's latest sre checkins.
Here's a boiled down example:

-------------------- snip snip --------------------
import re

ecre = re.compile(r'''
  =\?                   # literal =?
  (?P<charset>[^?]*?)   # non-greedy up to the next ? is the charset
  \?                    # literal ?
  (?P<encoding>[qb])    # either a "q" or a "b", case insensitive
  \?                    # literal ?
  (?P<atom>.*?)         # non-greedy up to the next ?= is the atom
  \?=                   # literal ?=
  ''', re.VERBOSE | re.IGNORECASE)

print ecre.split('=?iso-8859-1?q?this=20is=20some=20text?=', 1)
-------------------- snip snip --------------------

In Python 2.2b1 this prints

['', 'iso-8859-1', 'q', 'this=20is=20some=20text', '']

but in today's cvs this prints

['', 'iso-8859-1', 'q', 'this=20is=20some=20text']

Notice the missing trailing empty string.
:(

-Barry