[Zope-CMF] python 2.1 re bug workaround

seb bacon seb@jamkit.com
Fri, 25 May 2001 15:13:57 +0100


It looks like python 2.0 and 2.1 have a bug in the re module which
ends up in a recursion loop when you have a lazy match which exceeds
16k, e.g.

  http://sourceforge.net/tracker/?group_id=5470&atid=305470&aid=401612&func=detail

This causes problems when uploading large html Documents, at the point
where the <body> is parsed out.  I've tried this with ActivePython2.0
and 2.1.

A fix is to replace the 'import re' statment in CMFDefault/utils.py
with the following: 

  import sys
  if float(split(sys.version)[0]) > 1.6:
      import pre
      re = pre
  else:
      import re

cheers,

seb