New issue 2423: [cpyext] wrong __new__ assigned to tp_new for app-level classes
https://bitbucket.org/pypy/pypy/issues/2423/cpyext-wrong-__new__-assigned-to-tp_new

mattip:

I created a test in the ``missing-tp_new`` branch that demonstrates how an 
app-level class's ``__new__`` is not assigned to the ``tp_new`` slot, rather 
the generic ``object``'s ``__new__`` is assigned instead. AFAICT the problem is 
in the use of ``typedef = w_type.layout.typedef`` in line 249 of cpyext.py. The 
typedef is not unique to the w_type, and this non-unique object is used as a 
part of the key to lookup wrappers in the slotdef.py ``SLOTS`` dictionary. 

I think this is only a problem for the ``__new__`` method. I tried working 
around it by creating another ``NEW`` dictionary for the tp_new slot (as a 
special case in ``update_all_slots``, but could not get the pieces quite in the 
right place to make it translate.


_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to