From 5e1164c6b31d107be9ec64660a610fa9f75f04fa Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 11 Jul 2008 14:32:07 +0200 Subject: [PATCH] fix code writer indentation correct for '} else {' --- Cython/Compiler/Code.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/Code.py b/Cython/Compiler/Code.py index afba02f8..ce615cf1 100644 --- a/Cython/Compiler/Code.py +++ b/Cython/Compiler/Code.py @@ -64,13 +64,17 @@ class CCodeWriter: dl = code.count("{") - code.count("}") if dl < 0: self.level += dl + elif dl == 0 and code.startswith('}'): + self.level -= 1 if self.bol: self.indent() self._write(code) self.bol = 0 if dl > 0: self.level += dl - + elif dl == 0 and code.startswith('}'): + self.level += 1 + def increase_indent(self): self.level = self.level + 1 -- 2.26.2