Author: Ronan Lamy <[email protected]>
Branch: fix-broken-types
Changeset: r88549:2520706e5bb0
Date: 2016-11-22 17:36 +0000
http://bitbucket.org/pypy/pypy/changeset/2520706e5bb0/

Log:    Add translation flag (no effect yet)

diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -50,6 +50,7 @@
         if bookkeeper is None:
             bookkeeper = Bookkeeper(self)
         self.bookkeeper = bookkeeper
+        self.allow_bad_unions = True  # temporary feature flag, see 
config.translation.brokentypes
 
     def __getstate__(self):
         attrs = """translator pendingblocks annotated links_followed
diff --git a/rpython/config/translationoption.py 
b/rpython/config/translationoption.py
--- a/rpython/config/translationoption.py
+++ b/rpython/config/translationoption.py
@@ -181,6 +181,11 @@
                "attempt to pre-allocate the list",
                default=False,
                cmdline='--listcompr'),
+    BoolOption("brokentypes",
+               "Allow unsafe type unions in the annotator for "
+               "backwards compatibility.",
+               default=True,
+               cmdline='--broken-types'),
     IntOption("withsmallfuncsets",
               "Represent groups of less funtions than this as indices into an 
array",
                default=0),
diff --git a/rpython/translator/translator.py b/rpython/translator/translator.py
--- a/rpython/translator/translator.py
+++ b/rpython/translator/translator.py
@@ -68,6 +68,7 @@
             raise ValueError("we already have an annotator")
         from rpython.annotator.annrpython import RPythonAnnotator
         self.annotator = RPythonAnnotator(self, policy=policy)
+        self.annotator.allow_bad_unions = self.config.translation.brokentypes
         return self.annotator
 
     def buildrtyper(self):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to