Issue2008
Created on 2013-01-19.15:09:37 by irmen, last changed 2014-06-19.06:27:23 by zyasoft.
msg7581 (view) |
Author: Irmen de Jong (irmen) |
Date: 2013-01-19.15:09:37 |
|
The compile() function doesn't pay attention to the unicode_literals flag. It still parses str literals as str, instead of unicode.
[G:\temp]type tests.py
import __future__
import ast
# code object
c = compile("s='hello'; print s,type(s)",
"<unknown>", mode="exec",
flags=__future__.unicode_literals.compiler_flag)
exec c
# ast
a = compile("'hello'",
"<unknown>", mode="eval",
flags=ast.PyCF_ONLY_AST | __future__.unicode_literals.compiler_flag)
print a.body.s, type(a.body.s)
[G:\temp]python tests.py
hello <type 'unicode'>
hello <type 'unicode'>
[G:\temp]d:\TOOLS\jython-repo\dist\bin\jython.bat tests.py
hello <type 'str'>
hello <type 'str'>
The last 2 should be 'unicode' as well. Doing from __future__ import unicode_literals, which works for normal python modules, doesn't help for the compile() function.
|
msg8727 (view) |
Author: Jim Baker (zyasoft) |
Date: 2014-06-19.06:27:23 |
|
Likely the same underlying bug seen in #2039
Target beta 4, this is important
|
|
Date |
User |
Action |
Args |
2014-06-19 06:27:23 | zyasoft | set | nosy:
+ zyasoft messages:
+ msg8727 |
2013-02-20 00:24:25 | fwierzbicki | set | priority: normal nosy:
+ fwierzbicki versions:
+ Jython 2.7, - 2.7a2 |
2013-01-19 15:09:37 | irmen | create | |
|