Commit f00f3b54 authored by Stefan Behnel's avatar Stefan Behnel

moved method cache invalidation next to dict update, as proposed by Lisandro

parent 13e888fb
...@@ -989,6 +989,12 @@ class NameNode(AtomicExprNode): ...@@ -989,6 +989,12 @@ class NameNode(AtomicExprNode):
namespace, namespace,
self.interned_cname, self.interned_cname,
rhs.py_result())) rhs.py_result()))
# in Py2.6+, we need to invalidate the method cache
typeptr_cname = entry.scope.parent_type.typeptr_cname
code.putln("#if PY_VERSION_HEX >= 0x02060000")
code.putln("(%s)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;" %
typeptr_cname)
code.putln("#endif")
else: else:
code.put_error_if_neg(self.pos, code.put_error_if_neg(self.pos,
'PyObject_SetAttr(%s, %s, %s)' % ( 'PyObject_SetAttr(%s, %s, %s)' % (
......
...@@ -2101,11 +2101,6 @@ class CClassDefNode(StatNode, BlockNode): ...@@ -2101,11 +2101,6 @@ class CClassDefNode(StatNode, BlockNode):
# default values of method arguments. # default values of method arguments.
if self.body: if self.body:
self.body.generate_execution_code(code) 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): def annotate(self, code):
if self.body: if self.body:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment