[Python-mode] [Bug 450552] Re: python-mode breaks for python 3

Andreas Roehler andreas.roehler at online.de
Thu Oct 22 17:02:31 CEST 2009


...
>     >     Rustom wrote:
>     >     > (cmd (format "exec(compile(open('%s').read(), '%s', 'exec')) #
>     >     > PYTHON-MODE\n" filename filename)))
> 
>     For me both of your variants are working, see output of checks below.
> 
> You probably need to try on windows.
> See
> http://bugs.python.org/issue5524

Hmm, AFAIU the use of `compile' here on windows is to signal an error if the file contains "\r" chars?
Right?


> 
>     uname -a && python --version && cat 2+4.py && cat exec-read.py &&
>     python exec-read.py &&
>                                          cat exec-compile-read.py &&
>     python exec-compile-read.py
> 
>     ==>
> 
>     Linux ... 2.6.22.19-0.2-default #1 SMP 2008-12-18 10:17:03 +0100
>     i686 athlon i386 GNU/Linux
>     Python 2.5.1
>     #! /usr/bin/env python
>      # -*- coding: utf-8 -*-
> 
>     print 2 + 4
>     ##################
>     #! /usr/bin/env python
>      # -*- coding: utf-8 -*-
> 
>     exec(open('2+4.py').read())
>     ######################
> 
>     6
>     #! /usr/bin/env python
>      # -*- coding: utf-8 -*-
> 
>     exec(compile(open('2+4.py').read(), '2+4.py', 'exec'))
>     #################
> 
>     6
> 
> 
>     ;;;;;;;;;;;;;;;;;
> 
>     BTW can you tell whats the us of `compile' here for you?
> 
> See
> http://stackoverflow.com/questions/436198/what-is-an-alternative-to-execfile-in-python-3-0
> 
>  
> 
>     Do you have some tests for python-mode.el?
> 
> As in automated el/py etc? No
> As in biological? ...

If you may deliver a simple test case, how to call interactively it from inside emacs,
it might be helpful - at least for me... :)


Andreas

> Heres yours truly :-)



More information about the Python-mode mailing list