[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-03-30 Thread Jean-Michel Fauth
Jean-Michel Fauth wxjmfa...@gmail.com added the comment: Quick feedback from a Windows user. I made a few more tests with the freshly installed Pyton 3.1a1. The compile() function is running very well. As a side effect, it now possible to write an execfile() without any problem. Tests with

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-03-25 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: @jmfauth: Can you open a different issue for the IDLE issue? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4626 ___

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-03-25 Thread Jean-Michel Fauth
Jean-Michel Fauth wxjmfa...@gmail.com added the comment: Victor Yes, I could, but I think this is not an IDLE issue, I'm just using IDLE to illustrate the problem. I got the same when I'm working from within an editor or with my interactive interpreter I wrote for the fun. Code in the editor:

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-03-25 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Yes, I could, but I think this is not an IDLE issue (...) File uuu.py, line 8, in module ii.runsource(source) (...) File c:\python30\lib\codeop.py, line 70, in _maybe_compile for line in source.split(\n):

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-03-24 Thread Jean-Michel Fauth
Jean-Michel Fauth wxjmfa...@gmail.com added the comment: I'm glad to have discovered this topic. I bumped into something similar when I toyed with an interactive interpreter. from code import InteractiveInterpreter ii = InteractiveInterpreter() source = ... ii.runsource(source) What should be

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-03-24 Thread Brett Cannon
Brett Cannon br...@python.org added the comment: On Tue, Mar 24, 2009 at 09:24, Jean-Michel Fauth rep...@bugs.python.orgwrote: Jean-Michel Fauth wxjmfa...@gmail.com added the comment: I'm glad to have discovered this topic. I bumped into something similar when I toyed with an interactive

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-03-03 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Should this be backported? It's the r70113 (not the 70112). I see that pitrou backported the fix to 3.0.x. I think that it's enough, 2.x doesn't require the fix. ___ Python tracker

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-03-02 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: Fixed in r70112. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4626 ___

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-03-02 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: Should this be backported? ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4626 ___ ___

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-02-26 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I think that feature is ok to not support. Yeah! Anyone to review and/or commit the last patch? -- versions: +Python 3.1 ___ Python tracker rep...@bugs.python.org

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-02-26 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: I'll deal with it eventually. -- assignee: - benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4626 ___

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-02-22 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: On Tue, Feb 17, 2009 at 6:22 PM, STINNER Victor rep...@bugs.python.org wrote: I don't understand the change in source_as_string(). Except of that, it looks correct. Py_CFFLAGS_SOURCE_IS_UTF8 is already set in compile(). The one

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-02-17 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: @benjamin.peterson: I don't see you changes... I read both patches carrefuly and I saw: - source_as_string(): remove cf.cf_flags = supplied_flags | PyCF_SOURCE_IS_UTF8; - rename PyTokenizer_FromUnicode() to PyTokenizer_FromUTF8()

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-02-14 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: Here's another patch. The one problem is that it causes test_coding to fail because coding cookies are ignored and not checked to see if they are the same as the encoding of the file. It seems fine to me to just skip this test. --

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-29 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I don't like the change of API to PyTokenizer_FromString. I would prefer another function like PyTokenizer_IgnoreCodingCookie() Ok, I created a new function PyTokenizer_FromUnicode(). I choosed FromUnicode because the string is

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-29 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file12771/tokenizer_ignore_cookie-3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4626 ___

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-29 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: On Thu, Jan 29, 2009 at 5:13 PM, STINNER Victor rep...@bugs.python.org wrote: Ok, I created a new function PyTokenizer_FromUnicode(). I choosed FromUnicode because the string is encoded in unicode (as UTF-8, even if it's not the

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-27 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Note that PyTokenizer_FromString is not an API function: it's not marked with PyAPI_FUNC, and not exported from the windows DLL. ___ Python tracker rep...@bugs.python.org

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-26 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Ping! Can anyone review my patch? ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4626 ___ ___

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-26 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: I don't like the change of API to PyTokenizer_FromString. I would prefer another function like PyTokenizer_IgnoreCodingCookie() blows up when parsing has already started. The (char *) cast in PyTokenizer_FromString is unneeded. You need

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-16 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: New version of my patch: add a regression test. @brett.cannon: Could you review my patch? Added file: http://bugs.python.org/file12771/tokenizer_ignore_cookie-3.patch ___ Python tracker

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-16 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file12589/tokenizer_ignore_cookie-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4626 ___

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-16 Thread Brett Cannon
Brett Cannon br...@python.org added the comment: I will see when I can get to it (other stuff is taking priority). Not going to assign to myself quite yet in case someone wants to beat me to this. I won't lose track since I created the bug and have a saved query to look at all bugs I make.

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-04 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: The function decode_str() (Parser/tokenizer.c) is responsible to detect the encoding using the BOM or the cookie (coding: xxx). decode_str() reencodes also the text to utf-8 if the encoding is different than utf-8. I think that we

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-04 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Oops, I attached the wrong file :-p Added file: http://bugs.python.org/file12589/tokenizer_ignore_cookie-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4626

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-04 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file12588/tokenizer_ignore_cookie.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4626 ___

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-04 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: With my patch, the first Brett's example displays: ... ” = '”' ^ SyntaxError: invalid character in identifier The error cursor is not at the right column (bug related to the issue 2382 or introduced by

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-02 Thread Brett Cannon
Brett Cannon br...@python.org added the comment: Here is what I have found out so far. Python/bltinmodule.c:builtin_compile takes in a PyObject and gets the char * representation of that object and passes it to Python/pythonrun.c:Py_CompileStringFlags. Unfortunately no other information is

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2009-01-02 Thread Brett Cannon
Brett Cannon br...@python.org added the comment: So explicitly converting to UTF-8 didn't work, or at least as simply as I had hoped. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4626 ___

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2008-12-30 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Issue4742 is similar issue: source = b# coding=cp1252\n\x94 = '\x94'.decode('cp1252') compile(source, 'test', 'exec') Traceback (most recent call last): File stdin, line 1, in module File test, line 0 SyntaxError: unknown

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2008-12-30 Thread John Machin
Changes by John Machin sjmac...@users.sourceforge.net: -- nosy: +sjmachin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4626 ___ ___

[issue4626] compile() doesn't ignore the source encoding when a string is passed in

2008-12-10 Thread Brett Cannon
New submission from Brett Cannon [EMAIL PROTECTED]: When compile() is called with a string it is a reasonable assumption that it has already been decoded. But this is not in fact the case and leads to errors when trying to use non-ASCII identifiers:: source = # coding=latin-1\n\u00c6 =