[issue18870] eval() uses latin-1 to decode str

2013-09-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset 869cbcabb934 by Benjamin Peterson in branch '2.7': document that various functions that parse from source will interpret things as latin-1 (closes #18870) http://hg.python.org/cpython/rev/869cbcabb934 -- nosy: +python-dev resolution: -> fi

[issue18870] eval() uses latin-1 to decode str

2013-08-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue15809. -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailin

[issue18870] eval() uses latin-1 to decode str

2013-08-29 Thread Merlijn van Deen
Merlijn van Deen added the comment: On the lowest level, this affects exec, eval(), compile() and input() (!). On a higher level, more modules are affected: modules ast, codeop, compiler, cProfile, dis, distutils (not sure), doctest, idlelib, ihooks, pdb, pkgutil, plat-mac, py_compile, rexec,

[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread Benjamin Peterson
Benjamin Peterson added the comment: Yeah, this is an obnoxious bug. Too late to fix in Python 3, though. I would take a doc patch. -- components: +Documentation -Interpreter Core ___ Python tracker __

[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread R. David Murray
R. David Murray added the comment: Heh. Obviously I've forgotten some things about python2. I could have sworn the default was latin-1, but perhaps that was just the stdlib standard for coding cookies? I don't use python2 much any more... -- ___

[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Since the default source encoding in python2 is latin-1 Mmh, really? According to PEP 263: Python will default to ASCII as standard encoding if no other encoding hints are given. And indeed when trying Merlijn's code in a .py file rather than an eval

[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: $ python Python 2.7.4 (default, Apr 19 2013, 18:28:01) [GCC 4.7.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> eval("u'ä'") u'\xc3\xa4' >>> import locale >>> locale.getpreferredencoding() 'UTF-8' --

[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread STINNER Victor
STINNER Victor added the comment: Where / how do you type the eval() instruction? In IDLE, in the interactive prompt (>>>) or in a script (test.py)? What is your OS and what is your locale encoding? Example: $ python -m platform Linux-3.9.4-200.fc18.x86_64-x86_64-with-fedora-18-Spherical_Cow

[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread R. David Murray
R. David Murray added the comment: I don't think it is even "won't fix". Your "workarounds" are just the way you need to feed non-latin1 text into Python2. Since the default source encoding in python2 is latin-1, and that is documented, I'm not sure what additional documentation you want? -

[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread Merlijn van Deen
New submission from Merlijn van Deen: Steps to reproduce: --- >>> eval("u'ä'") # in an utf-8 console, so this is equivalent to >>> eval("u'\xc3\xa4'") Actual result: u'\xc3\xa4' # i.e.: u'ä' Expected result: - SyntaxError: Non-ASCII character '\