eryksun added the comment:

To be consistent you'd have to do the attribute check in PyObject_Call as well, 
i.e. if an object isn't callable, then trying to call it should raise a 
TypeError. I think the cost can be mitigated by only checking heap types (i.e. 
tp_flags & Py_TPFLAGS_HEAPTYPE).

It would be cleaner if slot_tp_call failed by raising TypeError instead of 
letting the AttributeError bubble up. There's a precedent in slot_tp_iter to 
raise a TypeError if lookup_method() fails. This would avoid having to change 
PyObject_Call.

----------
nosy: +eryksun

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23990>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to