[pypy-commit] pypy default: Add a sanity check.

arigo noreply at buildbot.pypy.org
Wed Oct 31 17:47:52 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r58645:1946e86bd7a5
Date: 2012-10-31 17:34 +0100
http://bitbucket.org/pypy/pypy/changeset/1946e86bd7a5/

Log:	Add a sanity check.

diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -843,10 +843,14 @@
             isinstance(w_newtype, W_TypeObject) and
             not w_newtype.is_heaptype() and
             not space.is_w(w_newtype, space.w_type)):
-            w_type.w_bltin_new = w_newfunc
+            w_type.w_bltin_new = w_bltin_new = w_newfunc
         w_newobject = space.call_obj_args(w_newfunc, w_type, __args__)
         call_init = space.isinstance_w(w_newobject, w_type)
 
+    # sanity check
+    if not we_are_translated() and w_bltin_new is not None:
+        assert space.isinstance_w(w_newobject, w_type)
+
     # maybe invoke the __init__ of the type
     if (call_init and not (space.is_w(w_type, space.w_type) and
         not __args__.keywords and len(__args__.arguments_w) == 1)):


More information about the pypy-commit mailing list