[pypy-commit] pypy default: Don't ever call SomeObject()

rlamy noreply at buildbot.pypy.org
Thu May 15 20:37:40 CEST 2014


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: 
Changeset: r71534:ad72a92bf0ac
Date: 2014-05-15 19:36 +0100
http://bitbucket.org/pypy/pypy/changeset/ad72a92bf0ac/

Log:	Don't ever call SomeObject()

diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py
--- a/rpython/annotator/binaryop.py
+++ b/rpython/annotator/binaryop.py
@@ -834,5 +834,5 @@
         else:
             basedef = s_wrf1.classdef.commonbase(s_wrf2.classdef)
             if basedef is None:    # no common base class! complain...
-                return SomeObject()
+                raise UnionError(s_wrf1, s_wrf2)
         return SomeWeakRef(basedef)
diff --git a/rpython/annotator/builtin.py b/rpython/annotator/builtin.py
--- a/rpython/annotator/builtin.py
+++ b/rpython/annotator/builtin.py
@@ -211,7 +211,7 @@
 def builtin_tuple(s_iterable):
     if isinstance(s_iterable, SomeTuple):
         return s_iterable
-    return SomeObject()
+    return AnnotatorError("tuple(): argument must be another tuple")
 
 def builtin_list(s_iterable):
     if isinstance(s_iterable, SomeList):
diff --git a/rpython/rlib/rweakref.py b/rpython/rlib/rweakref.py
--- a/rpython/rlib/rweakref.py
+++ b/rpython/rlib/rweakref.py
@@ -117,7 +117,7 @@
 class __extend__(pairtype(SomeWeakValueDict, SomeWeakValueDict)):
     def union((s_wvd1, s_wvd2)):
         if s_wvd1.valueclassdef is not s_wvd2.valueclassdef:
-            return annmodel.SomeObject() # not the same class! complain...
+            raise UnionError(s_wvd1, s_wvd2, "not the same class!")
         s_key = annmodel.unionof(s_wvd1.s_key, s_wvd2.s_key)
         return SomeWeakValueDict(s_key, s_wvd1.valueclassdef)
 
@@ -182,9 +182,9 @@
 class __extend__(pairtype(SomeWeakKeyDict, SomeWeakKeyDict)):
     def union((s_wkd1, s_wkd2)):
         if s_wkd1.keyclassdef is not s_wkd2.keyclassdef:
-            return SomeObject() # not the same key class! complain...
+            raise UnionError(w_wkd1, s_wkd2, "not the same key class!")
         if s_wkd1.valueclassdef is not s_wkd2.valueclassdef:
-            return SomeObject() # not the same value class! complain...
+            raise UnionError(w_wkd1, s_wkd2, "not the same value class!")
         return SomeWeakKeyDict(s_wkd1.keyclassdef, s_wkd1.valueclassdef)
 
 class Entry(extregistry.ExtRegistryEntry):


More information about the pypy-commit mailing list