Commit ed278eec authored by Stefan Behnel's avatar Stefan Behnel

refactored get_preprocessor_guard() for readability

parent ab5c7f03
...@@ -1870,17 +1870,17 @@ class FuncDefNode(StatNode, BlockNode): ...@@ -1870,17 +1870,17 @@ class FuncDefNode(StatNode, BlockNode):
code.putln("}") code.putln("}")
def get_preprocessor_guard(self): def get_preprocessor_guard(self):
entry = self.entry if not self.entry.is_special:
is_buffer_slot = (entry.name in ("__getbuffer__", "__releasebuffer__") and return None
entry.scope.is_c_class_scope) name = self.entry.name
if entry.is_special and not is_buffer_slot: slot = TypeSlots.method_name_to_slot.get(name)
slot = TypeSlots.method_name_to_slot.get(entry.name) if not slot:
if slot: return None
preprocessor_guard = slot.preprocessor_guard_code() if name == '__long__' and not self.entry.scope.lookup_here('__int__'):
if (entry.name == '__long__' and return None
not entry.scope.lookup_here('__int__')): if name in ("__getbuffer__", "__releasebuffer__") and self.entry.scope.is_c_class_scope:
preprocessor_guard = None return None
return preprocessor_guard return slot.preprocessor_guard_code()
class CFuncDefNode(FuncDefNode): class CFuncDefNode(FuncDefNode):
......
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