[issue10977] Concrete object C API needs abstract path for subclasses of builtin types

Nick Coghlan report at bugs.python.org
Sun Mar 20 22:50:56 CET 2011


Nick Coghlan <ncoghlan at gmail.com> added the comment:

It's largely a backwards compatibility hack, but the concrete methods also have an optimised fast path that the generic methods lack.

So (for example), PyList_SetItem would now mean "this is *probably* a list, so check for that and use the fast path if the assumption is correct, otherwise fall back on PyObject_SetItem".

Currently, using the concrete API means your code potentially *breaks* if the assumption is incorrect.

Sounds like a good idea to me, and will fix a lot of cases of bad interaction between concrete types and related objects.

----------
nosy: +ncoghlan

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10977>
_______________________________________


More information about the Python-bugs-list mailing list