This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Patch for sre bug 610299
Type: Stage:
Components: Library (Lib) Versions: Python 2.2
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: glchapman, gvanrossum, loewis
Priority: high Keywords: patch

Created on 2002-11-04 16:48 by glchapman, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch.txt glchapman, 2002-11-04 18:28
Messages (6)
msg41546 - (view) Author: Greg Chapman (glchapman) Date: 2002-11-04 16:48
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.
msg41547 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-11-04 17:43
Logged In: YES 
user_id=21627

There's no uploaded file!  You have to check the
checkbox labeled "Check to Upload & Attach File"
when you upload a file.

Please try again.

(This is a SourceForge annoyance that we can do
nothing about. :-( )
msg41548 - (view) Author: Greg Chapman (glchapman) Date: 2002-11-04 18:28
Logged In: YES 
user_id=86307

Sorry, I though I marked the checkbox (I know I went throught 
the browse button to find the file).  Anyway, here's the file.
msg41549 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2003-02-23 14:15
Logged In: YES 
user_id=6380

Grabbing this since effbot seems unresponsive.
msg41550 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2003-02-24 01:28
Logged In: YES 
user_id=6380

Thanks! 

Fixed in 2.3.  Keeping open for fixing in 2.2.3.
msg41551 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2003-02-24 01:32
Logged In: YES 
user_id=6380

Backport checked in.
History
Date User Action Args
2022-04-10 16:05:48adminsetgithub: 37408
2002-11-04 16:48:09glchapmancreate