I think the cleanest way would be to find the occurrences of if (!PyType_HasFeature(type, Py_TPFLAGS_HAVE_VERSION_TAG))
in typeobject.c and replace !PyType_HasFeature(type, Py_TPFLAGS_HAVE_VERSION_TAG)
with 0. I have to change the lines to 3. Then edit the #define MCACHE_CACHEABLE_NAME(name)
macro at the top of the file so that it is always false.
Then just recompile Python and the method cache will disappear. To make one of these changes would be enough to stop the cache, but I think that looking at the code you would like to stop it, doing unnecessary work, keeping the cache unused.
My question, if only there was, if you are trying to replace it with something else, then, of course, you are still working on this code, so do you need to delete all existing method cache code first to give you a clean start?
source share