Skip to content

Commit

Permalink
Merge Christoph Holtermann's 'Pr pycons2to3' into maint.
Browse files Browse the repository at this point in the history
  • Loading branch information
jralls committed Apr 15, 2019
2 parents fc35595 + 5a73b9a commit 0251d04
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion gnucash/python/pycons/console.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
#
# Copyright (c) 2008, Nicolas Rougier
# All rights reserved.
Expand Down Expand Up @@ -35,6 +35,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion gnucash/python/pycons/ishell.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
#
# Adapted from:
#
Expand Down
14 changes: 7 additions & 7 deletions gnucash/python/pycons/shell.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
#
# Copyright (c) 2008, Nicolas Rougier
# All rights reserved.
Expand Down Expand Up @@ -63,9 +63,9 @@ def is_balanced (self, line):
"""

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 = []
Expand Down Expand Up @@ -155,18 +155,18 @@ def execute (self, console):
# 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()
elif hasattr (sys, 'exc_type') and sys.exc_type == SystemExit:
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()
Expand Down

0 comments on commit 0251d04

Please sign in to comment.