[issue1878] class attribute cache failure (regression)

Armin Rigo report at bugs.python.org
Mon Jan 21 11:16:25 CET 2008


Armin Rigo added the comment:

I don't see in general how the patch can be kept compatible with
extension modules that change the tp_dict of arbitrary types.  All I can
think of is a way to be safe against extension modules that only change
the tp_dict of their own non-heap types (i.e. types defined in C).  The
method cache is disabled for types that don't have the
Py_TPFLAGS_HAVE_VERSION_TAG flag; so if we would leave this flag out of
Py_TPFLAGS_DEFAULT, non-heap types from extension modules would by
default not use the cache.

I'm not sure about the API for this.  Would we then need to put
Py_TPFLAGS_HAVE_VERSION_TAG explicitly on all core types?  And about how
to change tp_dict in a way that makes the cache happy - do we need to
turn type_modified() into a public API?

All in all, the lack of abstraction of the C API might kill the idea of
this patch for CPython.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1878>
__________________________________


More information about the Python-bugs-list mailing list