[issue12636] IDLE ignores -*- coding -*- with -r option

2011-09-01 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Fixed, thanks for the report.

Python 2.7 is not affected by this bug.

--
versions: +Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12636
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12636] IDLE ignores -*- coding -*- with -r option

2011-09-01 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
resolution: works for me - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12636
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12636] IDLE ignores -*- coding -*- with -r option

2011-09-01 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset fef1ed14 by Victor Stinner in branch '3.2':
Issue #12636: IDLE reads the coding cookie when executing a Python script.
http://hg.python.org/cpython/rev/fef1ed14

New changeset a8748022504f by Victor Stinner in branch 'default':
Merge 3.2: Issue #12636: IDLE reads the coding cookie when executing a Python 
script.
http://hg.python.org/cpython/rev/a8748022504f

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12636
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12636] IDLE ignores -*- coding -*- with -r option

2011-08-31 Thread ledave123

ledave123 ledave...@yahoo.fr added the comment:

Here is the patch:

diff -r e8da570d29a8 Lib/idlelib/PyShell.py
--- a/Lib/idlelib/PyShell.pyWed Jul 27 21:28:23 2011 +0200
+++ b/Lib/idlelib/PyShell.pyWed Aug 31 20:16:38 2011 +0200
@@ -582,7 +582,9 @@
 def execfile(self, filename, source=None):
 Execute an existing file
 if source is None:
-source = open(filename, r).read()
+import tokenize
+with tokenize.open(filename) as filein:
+source = filein.read()
 try:
 code = compile(source, filename, exec)
 except (OverflowError, SyntaxError):

Sorry for taking such a long time, I was on holidays.

--
resolution:  - works for me

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12636
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12636] IDLE ignores -*- coding -*- with -r option

2011-07-28 Thread ledave123

ledave123 ledave...@yahoo.fr added the comment:

The problem can be fixed with tokenize :
I'm sorry I never submitted a path and I have no access to the source tree from 
here, if someone cares to do it, do not hesitate.

def execfile(self, filename, source=None):
Execute an existing file
if source is None:
import tokenize
source = tokenize.open(filename).read()

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12636
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12636] IDLE ignores -*- coding -*- with -r option

2011-07-28 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Yes, tokenize.open() should fix this issue, but you should close the file after 
using it. Use for example with tokenize.open(): 

Can you write a patch? You can download the source code using Mercurial or 
download it manually from http://hg.python.org/cpython/file/tip

See also our http://docs.python.org/devguide/

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12636
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12636] IDLE ignores -*- coding -*- with -r option

2011-07-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12636
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12636] IDLE ignores -*- coding -*- with -r option

2011-07-25 Thread ledave123

New submission from ledave123 ledave...@yahoo.fr:

I'm on Windows with cp1252 as the default encoding.
When I use -*- coding: c1252 -*- I get no problems.
When I use -*- coding: utf-8 -*- IDLE -r still opens the file with cp1252 
encoding.
Python.exe opens the file with utf-8 correctly.

I think the problem is in Python32\Lib\idlelib\PyShell.py line 585:
In class ModifiedInterpreter:

def execfile(self, filename, source=None):
Execute an existing file
if source is None:
source = open(filename, r).read() # this is the bug IMHO

--
components: IDLE
messages: 141081
nosy: ledave123
priority: normal
severity: normal
status: open
title: IDLE ignores -*- coding -*- with -r option
type: behavior
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12636
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com