impossible to execute a buffer with 'from future' imports

Bug #1063884 reported by Yaroslav Halchenko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
High
Andreas Roehler

Bug Description

I guess it is a design limitation and reincarnation of
https://bugs.launchpad.net/python-mode/+bug/925586
but since its message was concerned only with the line number, I decided to file a new one.

Trying to execute a buffer (C-c C-c, or explicit execute-buffer-ipython in menu) where buffer contains code with imports from future, it simply doesn't work:

In [54]: File "/home/yoh/.tmp/ipython-23366TKY.py", line 4
    from __future__ import with_statement
SyntaxError: from __future__ imports must occur at the beginning of the file

since that buffer's code gets "extended" with additional imports by python-mode.el ... not sure what has to be done (besides parsing out the code to be executed and moving future imports ahead ...?)

Changed in python-mode:
importance: Undecided → Medium
assignee: nobody → Andreas Roehler (a-roehler)
milestone: none → 6.1.0
Changed in python-mode:
status: New → Confirmed
importance: Medium → High
Changed in python-mode:
status: Confirmed → Fix Committed
Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.