[py3k] except as
authorRémi Cardona <remi.cardona@free.fr>
Tue, 22 Jul 2014 20:26:12 +0200
changeset 748 c97f90cd49c5
parent 747 3d80ee7bd789
child 749 c6aa72c82081
[py3k] except as Requires python >= 2.6.
__init__.py
setup.py
stcheck.py
test/unittest_parser.py
utils.py
--- a/__init__.py	Wed Jul 23 09:27:19 2014 +0200
+++ b/__init__.py	Tue Jul 22 20:26:12 2014 +0200
@@ -214,7 +214,7 @@
     parser = Hercule(HerculeScanner(rqlstring))
     try:
         return parser.goal()
-    except SyntaxError, ex:
+    except SyntaxError as ex:
         if not print_errors:
             if ex.pos is not None:
                 multi_lines_rql = rqlstring.splitlines()
--- a/setup.py	Wed Jul 23 09:27:19 2014 +0200
+++ b/setup.py	Tue Jul 22 20:26:12 2014 +0200
@@ -121,7 +121,7 @@
                 shutil.copy2(src, dest)
     try:
         os.mkdir(to_dir)
-    except OSError, ex:
+    except OSError as ex:
         # file exists ?
         import errno
         if ex.errno != errno.EEXIST:
--- a/stcheck.py	Wed Jul 23 09:27:19 2014 +0200
+++ b/stcheck.py	Tue Jul 22 20:26:12 2014 +0200
@@ -98,7 +98,7 @@
     def _visit(self, node, state):
         try:
             node.accept(self, state)
-        except GoTo, ex:
+        except GoTo as ex:
             self._visit(ex.node, state)
         else:
             for c in node.children:
@@ -420,12 +420,12 @@
         else:
             try:
                 funcdescr.check_nbargs(len(function.children))
-            except BadRQLQuery, ex:
+            except BadRQLQuery as ex:
                 state.error(str(ex))
             if self.backend is not None:
                 try:
                     funcdescr.st_check_backend(self.backend, function)
-                except BadRQLQuery, ex:
+                except BadRQLQuery as ex:
                     state.error(str(ex))
             if funcdescr.aggregat:
                 if isinstance(function.children[0], Function) and \
--- a/test/unittest_parser.py	Wed Jul 23 09:27:19 2014 +0200
+++ b/test/unittest_parser.py	Tue Jul 22 20:26:12 2014 +0200
@@ -172,13 +172,13 @@
         try:
             parser = Hercule(HerculeScanner(string))
             return parser.goal()
-        except SyntaxError, ex:
+        except SyntaxError as ex:
             if print_errors:
                 # try to get error message from yapps
                 print_error(ex, parser._scanner)
                 print
             raise
-        except Exception, ex:
+        except Exception as ex:
             if print_errors:
                 print string, ex
             raise
--- a/utils.py	Wed Jul 23 09:27:19 2014 +0200
+++ b/utils.py	Tue Jul 22 20:26:12 2014 +0200
@@ -102,7 +102,7 @@
     for term in funcnode.children:
         try:
             yield term.variable.stinfo['attrvar'] or term
-        except AttributeError, ex:
+        except AttributeError as ex:
             yield term
 
 def is_keyword(word):