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 meador.inge
Recipients meador.inge
Date 2010-09-28.13:17:16
SpamBayes Score 0.004075454
Marked as misclassified No
Message-id <1285679839.5.0.180278126855.issue9969@psf.upfronthosting.co.za>
In-reply-to
Content
Currently with 'py3k' only 'bytes' objects are accepted for tokenization:

>>> import io
>>> import tokenize
>>> tokenize.tokenize(io.StringIO("1+1").readline)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/minge/Code/python/py3k/Lib/tokenize.py", line 360, in tokenize
    encoding, consumed = detect_encoding(readline)
  File "/Users/minge/Code/python/py3k/Lib/tokenize.py", line 316, in detect_encoding
    if first.startswith(BOM_UTF8):
TypeError: Can't convert 'bytes' object to str implicitly
>>> tokenize.tokenize(io.BytesIO(b"1+1").readline)
<generator object _tokenize at 0x1007566e0>

In a discussion on python-dev (http://www.mail-archive.com/python-dev@python.org/msg52107.html) it was generally considered to be a good idea to add support for tokenizing 'str' objects as well.
History
Date User Action Args
2010-09-28 13:17:19meador.ingesetrecipients: + meador.inge
2010-09-28 13:17:19meador.ingesetmessageid: <1285679839.5.0.180278126855.issue9969@psf.upfronthosting.co.za>
2010-09-28 13:17:17meador.ingelinkissue9969 messages
2010-09-28 13:17:16meador.ingecreate