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.

Author pitrou
Recipients hdima, pitrou, pje
Date 2008-12-22.15:01:34
SpamBayes Score 2.7627782e-06
Marked as misclassified No
Message-id <1229958095.87.0.754259018529.issue4718@psf.upfronthosting.co.za>
In-reply-to
Content
FYI, instead of trying to do exhaustive type checking in _check_type(),
you can just rely on duck typing and catch the TypeError:

>>> str(b"a", "utf-8")
'a'
>>> str(bytearray(b"a"), "utf-8")
'a'
>>> str(memoryview(b"a"), "utf-8")
'a'
>>> str(1, "utf-8")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: coercing to str: need string or buffer, int found
History
Date User Action Args
2008-12-22 15:01:36pitrousetrecipients: + pitrou, pje, hdima
2008-12-22 15:01:35pitrousetmessageid: <1229958095.87.0.754259018529.issue4718@psf.upfronthosting.co.za>
2008-12-22 15:01:35pitroulinkissue4718 messages
2008-12-22 15:01:34pitroucreate