[Python-Dev] Why is type_modified() in typeobject.c not a public function? (original) (raw)

Christian Heimes lists at cheimes.de
Wed May 28 13:43:46 CEST 2008


Stefan Behnel schrieb:

Straight forward patch is attached (against 3.0a5). Works for me in Cython. I thought about a name like "Taint(t)" or "ClearTypeCache(t)", but then went with the coward solution of calling the function PyTypeModified() as it was (almost) named internally.

BTW, I noticed that the code in typeobject.c uses "DECREF before set" two times, like this: methodcache[h].version = type->tpversiontag; methodcache[h].value = res; /* borrowed */ PyINCREF(name); PyDECREF(methodcache[h].name); methodcache[h].name = name; During the call to PyDECREF, the cache content is incorrect, so can't this run into the same problem that PyCLEAR() aims to solve? I attached a patch for that, too, just in case.

Please create two tickets in the bug tracker and append the patches.

Christian



More information about the Python-Dev mailing list