Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: fix-descrmismatch-crash
Changeset: r97766:da9a65e1debd
Date: 2019-10-13 00:09 +0200
http://bitbucket.org/pypy/pypy/changeset/da9a65e1debd/

Log:    fix first level of problems: args.firstarg() is always None in this
        context, use w_obj instead

diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -709,6 +709,7 @@
                     self.func__args__ = func
                 elif unwrap_spec == [self_type, ObjSpace, Arguments]:
                     self.__class__ = BuiltinCodePassThroughArguments1
+                    self.descr_reqcls = self_type
                     miniglobals = {'func': func, 'self_type': self_type}
                     d = {}
                     source = """if 1:
@@ -808,7 +809,7 @@
         try:
             w_result = self.func__args__(space, w_obj, args)
         except DescrMismatch:
-            return args.firstarg().descr_call_mismatch(space,
+            return w_obj.descr_call_mismatch(space,
                                                   self.descrmismatch_op,
                                                   self.descr_reqcls,
                                                   args.prepend(w_obj))
diff --git a/pypy/interpreter/test/test_gateway.py 
b/pypy/interpreter/test/test_gateway.py
--- a/pypy/interpreter/test/test_gateway.py
+++ b/pypy/interpreter/test/test_gateway.py
@@ -1005,3 +1005,13 @@
 
         d.update(**{clash: 33})
         dict.update(d, **{clash: 33})
+
+
+
+class AppTestFastPathCrash(object):
+    def test_fast_path_crash(self):
+        with raises(TypeError) as excinfo:
+            # does not crash in BuiltinCodePassThroughArguments0.funcrun
+            dict.__init__.im_func(0)
+        print(str(excinfo.value))
+        assert str(excinfo.value) == "'dict' object expected, got 'int' 
instead"
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to