[issue1878] class attribute cache failure (regression)

Armin Rigo report at bugs.python.org
Thu Jul 31 18:07:44 CEST 2008


Armin Rigo <arigo at users.sourceforge.net> added the comment:

Maybe there is a better solution along the following line: conditionally
define Py_TPFLAGS_DEFAULT so that when compiling the Python core it
includes the Py_TPFLAGS_HAVE_VERSION_TAG, but when compiling extension
modules it does not.  This should ensure compatibility with many
existing extension modules.  (It would still break if they play tricks
like modifying the tp_dict of types other than their own.)

In addition, to support the method cache in newer C extension modules:

* C types defined by C extension modules can include the
Py_TPFLAGS_HAVE_VERSION_TAG explicitly to enable the cache;

* new C API functions should be introduced to give an official way to
access the tp_dict of a type, e.g. PyType_{Get,Set,Del}DictItemString().

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


More information about the Python-bugs-list mailing list