[Patches] [ python-Patches-633359 ] Patch for sre bug 610299

noreply@sourceforge.net noreply@sourceforge.net
Mon, 04 Nov 2002 08:48:10 -0800


Patches item #633359, was opened at 2002-11-04 07:48
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=633359&group_id=5470

Category: Library (Lib)
Group: Python 2.2.x
Status: Open
Resolution: None
Priority: 5
Submitted By: Greg Chapman (glchapman)
Assigned to: Nobody/Anonymous (nobody)
Summary: Patch for sre bug 610299

Initial Comment:
Bug report 610299 points out this discrepancy:

>>> re.compile(r'\w{1}', re.U).sub('X', u'hello caf\xe9') 
u'XXXXX XXXX' 
>>> re.compile(r'\w', re.U).sub('X', u'hello caf\xe9') 
u'XXXXX XXX\xe9' 

The problem is in sre_compile.py: the call to 
_compile_charset near the end of _compile_info forgets to 
pass in the flags, so that the info charset is not compiled 
with re.U.  (The info charset is used when searching to find 
the first character at which a match could start; it is not 
generated for patterns beginning with a repeat like '\w{1}'.)

The attached patch changes this call to pass in the flags; it 
is against the 2.2.2 version of sre_compile.py.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=633359&group_id=5470