Author: Ronan Lamy <[email protected]>
Branch: py3.6
Changeset: r97245:1114b8c0be6d
Date: 2019-08-22 17:30 +0100
http://bitbucket.org/pypy/pypy/changeset/1114b8c0be6d/

Log:    Fix annotations related to _new_int()

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -296,14 +296,17 @@
                     "expected %s, got %T object", expected, self)
 
     def int(self, space):
+        from pypy.objspace.std.intobject import W_AbstractIntObject
         w_impl = space.lookup(self, '__int__')
         if w_impl is None:
             self._typed_unwrap_error(space, "integer")
         w_result = space.get_and_call_function(w_impl, self)
 
         if space.is_w(space.type(w_result), space.w_int):
+            assert isinstance(w_result, W_AbstractIntObject)
             return w_result
         if space.isinstance_w(w_result, space.w_int):
+            assert isinstance(w_result, W_AbstractIntObject)
             tp = space.type(w_result).name
             space.warn(space.newtext(
                 "__int__ returned non-int (type %s).  "
@@ -815,7 +818,7 @@
             return self.w_None
         return w_obj
 
-    @signature(types.any(), types.bool(), returns=types.instance(W_Root))
+    @signature(types.any(), types.bool(), returns=types.any())
     def newbool(self, b):
         if b:
             return self.w_True
diff --git a/pypy/objspace/std/intobject.py b/pypy/objspace/std/intobject.py
--- a/pypy/objspace/std/intobject.py
+++ b/pypy/objspace/std/intobject.py
@@ -960,7 +960,7 @@
     elif W_SmallLongObject and type(w_value) is W_SmallLongObject:
         return newbigint(space, w_inttype, space.bigint_w(w_value))
 
-#@enforceargs(None, W_AbstractIntObject, typecheck=False)
+@enforceargs(None, W_AbstractIntObject, typecheck=False)
 def _ensure_baseint(space, w_intvalue):
     from pypy.objspace.std.longobject import (
         W_LongObject, W_AbstractLongObject, newlong)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to