Merge Christoph Holtermann's 'Pr pycons2to3' into maint.

This commit is contained in:
John Ralls 2019-04-15 14:25:49 -07:00
commit 0251d044b5
3 changed files with 10 additions and 9 deletions

View File

@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
#
# Copyright (c) 2008, Nicolas Rougier
# All rights reserved.
@ -35,6 +35,7 @@ import gi
gi.require_version('Gtk', '3.0')
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
import io
import pycons.shell as shell

View File

@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
#
# Adapted from:
#

View File

@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
#
# Copyright (c) 2008, Nicolas Rougier
# All rights reserved.
@ -63,9 +63,9 @@ class Shell:
"""
s = line
s = filter(lambda x: x in '()[]{}"\'', s)
s = s.replace ("'''", "'")
s = s.replace ('"""', '"')
s = list(filter(lambda x: x in '()[]{}"\'', s))
# s = s.replace ("'''", "'")
# s = s.replace ('"""', '"')
instring = False
brackets = {'(':')', '[':']', '{':'}', '"':'"', '\'':'\''}
stack = []
@ -155,7 +155,7 @@ class Shell:
# Command output
print(repr(r))
except SyntaxError:
exec(self.command in self.globals)
exec(str(self.command), self.globals)
except:
if hasattr (sys, 'last_type') and sys.last_type == SystemExit:
console.quit()
@ -163,10 +163,10 @@ class Shell:
console.quit()
else:
try:
tb = sys.exc_traceback
tb = sys.exc_info()[2]
if tb:
tb=tb.tb_next
traceback.print_exception(sys.exc_type, sys.exc_value, tb)
traceback.print_exception(sys.exc_info()[0], sys.exc_info()[1], tb)
except:
sys.stderr, console.stderr = console.stderr, sys.stderr
traceback.print_exc()