[pypy-commit] pypy missing-tp_new: Fix

arigo pypy.commits at gmail.com
Tue Nov 1 04:51:32 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: missing-tp_new
Changeset: r88009:67074ec10639
Date: 2016-11-01 09:01 +0000
http://bitbucket.org/pypy/pypy/changeset/67074ec10639/

Log:	Fix

diff --git a/pypy/module/cpyext/userslot.py b/pypy/module/cpyext/userslot.py
--- a/pypy/module/cpyext/userslot.py
+++ b/pypy/module/cpyext/userslot.py
@@ -30,10 +30,7 @@
 
 @cpython_api([PyTypeObjectPtr, PyObject, PyObject], PyObject, header=None)
 def slot_tp_new(space, w_type, w_args, w_kwds):
-    _, w_descr = space.lookup_in_type_where(w_type, '__new__')
-    if w_descr is None:
-        raise oefmt(space.w_RuntimeError, "cpyext: '__new__' not found")
-    # w_descr is typically a StaticMethod
+    w_impl = space.getattr(w_type, space.wrap('__new__'))
     args = Arguments(space, [w_type],
                      w_stararg=w_args, w_starstararg=w_kwds)
-    return space.call_args(space.get(w_descr, w_type), args)
+    return space.call_args(w_impl, args)


More information about the pypy-commit mailing list