[ python-Bugs-1758804 ] unicode(None,charset) raise TypeError

SourceForge.net noreply at sourceforge.net
Mon Jul 23 12:39:54 CEST 2007


Bugs item #1758804, was opened at 2007-07-23 10:39
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1758804&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Unicode
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Guillaume (guillaumb)
Assigned to: M.-A. Lemburg (lemburg)
Summary: unicode(None,charset) raise TypeError

Initial Comment:
Behavior of unicode() builtin is not the same with None as the first argument if we give  the second optional argument.

>>> unicode(None)
u'None'
>>> unicode(None,'ascii')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: coercing to Unicode: need string or buffer, NoneType found

This is confusing.


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

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


More information about the Python-bugs-list mailing list