Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r326:bfc5304e5a50
Date: 2015-05-26 21:38 +0200
http://bitbucket.org/pypy/benchmarks/changeset/bfc5304e5a50/

Log:    Under some unknown circumstance, it is possible to hit a path where
        a Branch instance doesn't have a "lineno" attribute, but we try to
        read it anyway. I've given up trying to figure out why it seems to
        occur (rarely) on top of PyPy but (apparently) not on top of
        CPython. Instead, always stick lineno and col_offset attributes,
        defaulting to 0.

diff --git a/own/icbd/icbd/util/cfa.py b/own/icbd/icbd/util/cfa.py
--- a/own/icbd/icbd/util/cfa.py
+++ b/own/icbd/icbd/util/cfa.py
@@ -22,9 +22,8 @@
         self.true_block = None
         self.false_block = None
 
-        if lineno:
-            self.lineno = lineno
-            self.col_offset = 0
+        self.lineno = lineno or 0
+        self.col_offset = 0
 
     def set_true(self, bid):
         assert isinstance(bid, int)
@@ -39,10 +38,8 @@
     def __init__(self, iter, lineno=None, col_offset=None):
         assert isinstance(iter, _ast.AST)
         self.iter = iter
-        if lineno:
-            self.lineno = lineno
-        if col_offset:
-            self.col_offset = col_offset
+        self.lineno = lineno or 0
+        self.col_offset = col_offset or 0
 
 class CFG(object):
     def __init__(self):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to