[pypy-commit] pypy rpython-sprint: Remove check added in last commit.

ariava pypy.commits at gmail.com
Sun Mar 18 13:49:45 EDT 2018


Author: Arianna Avanzini <avanzini.arianna at gmail.com>
Branch: rpython-sprint
Changeset: r93992:737e0369f12e
Date: 2018-03-18 18:48 +0100
http://bitbucket.org/pypy/pypy/changeset/737e0369f12e/

Log:	Remove check added in last commit.

	Check was about disallowing annotation of iterable objects with zero
	length. Annotation is also used by marshalling, where having zero
	length iterables is accepted.

diff --git a/rpython/annotator/signature.py b/rpython/annotator/signature.py
--- a/rpython/annotator/signature.py
+++ b/rpython/annotator/signature.py
@@ -43,12 +43,11 @@
     try:
         _ = iter(t)
     except TypeError:  # if it's not an iterable, just return
-        return t
-    if len(t) == 0:
-        raise ValueError("Cannot handle empty %s in args enforcing", type(t))
-    if isinstance(t, tuple) or len(t) == 1:  # we accept tuples with len > 1 because
-        return t                             # tuple items are all of same type
-    raise TypeError("Cannot specify multiple types in a %s (try using tuple)", type(t))
+        return t       # (size does not matter)
+    if isinstance(t, tuple):  # we accept tuples with any length, because
+        return t              # their in-memory representation is predictable
+    if len(t) > 1:
+        raise TypeError("Cannot specify multiple types in a %s (try using tuple)", type(t))
 
 
 def _compute_annotation(t, bookkeeper=None):


More information about the pypy-commit mailing list