Skip to content

Commit e35ced0

Browse files
author
Michael Schuller
committed
Fix Python 2.5 compatability.
Adds the necessary "from __future__" imports and modifies the syntax of exception handling to provide compatability back to Python 2.5.
1 parent 32f0ab1 commit e35ced0

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

bpython/autocomplete.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# THE SOFTWARE.
2222
#
2323

24+
from __future__ import with_statement
2425
import __builtin__
2526
import rlcompleter
2627
import re

bpython/curtsies.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import with_statement
12
from __future__ import absolute_import
23

34
import sys
@@ -66,7 +67,8 @@ def mainloop(config, locals_, banner, interp=None, paste=None):
6667
def process_event(e):
6768
try:
6869
repl.process_event(e)
69-
except (SystemExitFromCodeGreenlet, SystemExit) as err:
70+
except (SystemExitFromCodeGreenlet, SystemExit):
71+
err = sys.exc_info()[1]
7072
array, cursor_pos = repl.paint(about_to_exit=True, user_quit=isinstance(err, SystemExitFromCodeGreenlet))
7173
scrolled = term.render_to_terminal(array, cursor_pos)
7274
repl.scroll_offset += scrolled

bpython/curtsiesfrontend/repl.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import with_statement
12
import code
23
import contextlib
34
import errno

0 commit comments

Comments
 (0)