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: re.sub on u'' gives NON-unicode ''
Type: Stage:
Components: Regular Expressions Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: hyeshik.chang Nosy List: aleax, hyeshik.chang, loewis
Priority: normal Keywords:

Created on 2004-03-30 15:27 by aleax, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
sretypeconsistency.diff hyeshik.chang, 2004-04-01 05:47 a fix to avoid type-insensible cache of sre.compile
Messages (5)
msg20382 - (view) Author: Alex Martelli (aleax) * (Python committer) Date: 2004-03-30 15:27
>>> import re 
>>> re.sub(u'.', u'', u'') 
'' 
 
This holds for any RE that doesn't match the empty string. 
 
msg20383 - (view) Author: Hyeshik Chang (hyeshik.chang) * (Python committer) Date: 2004-04-01 05:47
Logged In: YES 
user_id=55188

Here's a fix.
msg20384 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-04-20 20:01
Logged In: YES 
user_id=21627

The patch is fine, please apply.
msg20385 - (view) Author: Hyeshik Chang (hyeshik.chang) * (Python committer) Date: 2004-04-20 21:16
Logged In: YES 
user_id=55188

got checked in. Thank you for the review!

HEAD ==
Misc/NEWS 1.967
Lib/sre.py 1.48

2.3-maint ==
Misc/NEWS 1.832.4.102
Lib/sre.py 1.47.6.1
msg20386 - (view) Author: Hyeshik Chang (hyeshik.chang) * (Python committer) Date: 2004-04-20 21:32
Logged In: YES 
user_id=55188

Another check-ins for the unittest:

Lib/test/test_re.py  head 1.48   2.3-maint 1.45.6.3
History
Date User Action Args
2022-04-11 14:56:03adminsetgithub: 40102
2004-03-30 15:27:51aleaxcreate