From: Stefan Behnel Date: Sat, 24 May 2008 08:33:28 +0000 (+0200) Subject: invalidate type cache in Py2.6+ X-Git-Tag: 0.9.8rc1~11^2~10^2~15^2~13 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0c531b34d54914be105d7ede14def237a0d19730;p=cython.git invalidate type cache in Py2.6+ --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index db1370a0..89e87437 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2101,6 +2101,11 @@ class CClassDefNode(StatNode, BlockNode): # default values of method arguments. if self.body: self.body.generate_execution_code(code) + # in Py2.6+, we need to invalidate the type cache + code.putln("#if PY_VERSION_HEX >= 0x02060000") + code.putln("(%s)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;" % + self.entry.type.typeptr_cname) + code.putln("#endif") def annotate(self, code): if self.body: