New issue 2491: cpyext-defined types with custom __qualname__ getset 
descriptors error on PyType_Ready
https://bitbucket.org/pypy/pypy/issues/2491/cpyext-defined-types-with-custom

CFSworks:

Certain CPython-API generating binding layers (the one I have in mind right now 
is Cython) may stick custom __qualname__ getset descriptors in their defined 
types.

In CPython 3, this is allowed. The __qualname__-is-str check only occurs on 
type.__new__, so PyType_Ready'd custom types can bypass this check and include 
a custom descriptor if they'd like. In PyPy 3's cpyext, the C structs are 
flattened down to a dict and passed into the W_TypeObject constructor, which 
itself enforces the __qualname__ type check (which should, by the way, have a 
far more helpful error than "TypeError: expected string, got getset_descriptor 
object").

This should be resolved by not filtering __qualname__ out of dict_w when cpyext 
creates a type.


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to