Gareth Rees <g...@garethrees.org> added the comment:

See my last paragraph: I propose to deliver a single patch that fixes both this 
bug and issue12675. I hope this is OK. (If you prefer, I'll try to split the 
patch in two.)

I just noticed another bug in untokenize(): in compatibility mode, if 
untokenize() is passed an iterator rather than a list, then the first token 
gets discarded:

    Python 3.3.0a0 (default:c099ba0a278e, Aug  2 2011, 12:35:03) 
    [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on 
darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from tokenize import untokenize
    >>> from token import *
    >>> untokenize([(NAME, 'hello')])
    'hello '
    >>> untokenize(iter([(NAME, 'hello')]))
    ''

No-one's noticed this because the unit tests only ever pass lists to 
untokenize().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12691>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to