[issue9690] Cannot distinguish b"str" from "str" in ast module.

Benjamin Peterson report at bugs.python.org
Fri Aug 27 15:18:13 CEST 2010


Benjamin Peterson <benjamin at python.org> added the comment:

2010/8/27 Kay Hayen <report at bugs.python.org>:
>
> Kay Hayen <kayhayen at gmx.de> added the comment:
>
> This is to inform you that I worked around the bug by reading the source file in question and checking the indicated position. This is currently the only way to decide if a literal should be unicode or str with unicode_literals from future imported.

I see. I'm not really sure what you're problem is again because if
unicode_literals is in effect, the AST will have decoded the literal
into unicode.

"Module(body=[ImportFrom(module='__future__',
names=[alias(name='unicode_literals', asname=None)], level=0),
Expr(value=Tuple(elts=[Str(s=u's'), Str(s=u's')], ctx=Load()))])"

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9690>
_______________________________________


More information about the Python-bugs-list mailing list