From 0c531b34d54914be105d7ede14def237a0d19730 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sat, 24 May 2008 10:33:28 +0200 Subject: [PATCH] invalidate type cache in Py2.6+ --- Cython/Compiler/Nodes.py | 5 +++++ 1 file changed, 5 insertions(+) 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: -- 2.26.2