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: Filter unicode into unicode
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: loewis Nosy List: lemburg, loewis, rhettinger
Priority: normal Keywords: patch

Created on 2002-11-09 20:15 by loewis, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
filter.diff loewis, 2003-01-21 21:38
Messages (6)
msg41605 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-11-09 20:15
Currently, filter(None, "abc") gives "abc", but
filter(None, u"abc") gives [u'a', u'b', u'c']. This
patches corrects this, adding a Unicode specical case
for filter.
msg41606 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2002-11-11 09:11
Logged In: YES 
user_id=38388

There's no patch attached to this SF item, but
you're right, filter() should behave in the same
way for 8-bit strings as for Unicode.
msg41607 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-01-19 03:04
Logged In: YES 
user_id=80475

Do you still have this patch available?
msg41608 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-01-21 21:38
Logged In: YES 
user_id=21627

Argh! I lost it, so I had to recreate. It is attached now.
msg41609 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-01-23 22:49
Logged In: YES 
user_id=80475

Looks good, compiles fine, passes regrtests, doesn't 
appear to have any leaks, and looks like a faithful 
interpretation of filterstring() just above it.

Consider expanding the tests to verify the
return type.  Since 'abc' == u'abc', the
current tests would pass even if the return
type were a non-unicode string.

Please apply.
msg41610 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-01-25 22:50
Logged In: YES 
user_id=21627

Committed as

test_builtin.py 1.4
NEWS 1.625
bltinmodule.c 2.271
History
Date User Action Args
2022-04-10 16:05:53adminsetgithub: 37448
2002-11-09 20:15:28loewiscreate