From: Lisandro Dalcin Date: Fri, 20 Aug 2010 16:17:54 +0000 (-0300) Subject: previous commit broke numpy buffer access for Py<=2.4 X-Git-Tag: 0.13~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=db243fcbbad66252fc780905d3984641a59c87c6;p=cython.git previous commit broke numpy buffer access for Py<=2.4 --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index fab63c1a..ecd4b8f7 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1216,11 +1216,18 @@ class FuncDefNode(StatNode, BlockNode): is_releasebuffer_slot = (self.entry.name == "__releasebuffer__" and self.entry.scope.is_c_class_scope) is_buffer_slot = is_getbuffer_slot or is_releasebuffer_slot - is_index_slot = (self.entry.name == "__index__" and - self.entry.scope.is_c_class_scope) - if is_buffer_slot or is_index_slot: + if is_buffer_slot: if 'cython_unused' not in self.modifiers: self.modifiers = self.modifiers + ['cython_unused'] + + preprocessor_guard = None + if self.entry.is_special and not is_buffer_slot: + slot = TypeSlots.method_name_to_slot.get(self.entry.name) + if slot: + preprocessor_guard = slot.preprocessor_guard_code() + if (self.entry.name == '__long__' and + not self.entry.scope.lookup_here('__int__')): + preprocessor_guard = None profile = code.globalstate.directives['profile'] if profile: @@ -1238,14 +1245,6 @@ class FuncDefNode(StatNode, BlockNode): # ----- Function header code.putln("") - preprocessor_guard = None - if self.entry.is_special: - slot = TypeSlots.method_name_to_slot.get(self.entry.name) - if slot: - preprocessor_guard = slot.preprocessor_guard_code() - if (self.entry.name == '__long__' and - not self.entry.scope.lookup_here('__int__')): - preprocessor_guard = None if preprocessor_guard: code.putln(preprocessor_guard)