From: Georg Brandl Date: Tue, 9 Sep 2008 19:31:25 +0000 (+0000) Subject: Fix formatter usage of filter(). Bug #3800. X-Git-Tag: v3.0rc1~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7cd67cc992acb659f1673706e037ee835648d60b;p=python Fix formatter usage of filter(). Bug #3800. --- diff --git a/Lib/formatter.py b/Lib/formatter.py index bb8ad20e44..60e60f1160 100644 --- a/Lib/formatter.py +++ b/Lib/formatter.py @@ -255,7 +255,7 @@ class AbstractFormatter: def push_margin(self, margin): self.margin_stack.append(margin) - fstack = filter(None, self.margin_stack) + fstack = [m for m in self.margin_stack if m] if not margin and fstack: margin = fstack[-1] self.writer.new_margin(margin, len(fstack)) @@ -263,7 +263,7 @@ class AbstractFormatter: def pop_margin(self): if self.margin_stack: del self.margin_stack[-1] - fstack = filter(None, self.margin_stack) + fstack = [m for m in self.margin_stack if m] if fstack: margin = fstack[-1] else: diff --git a/Misc/NEWS b/Misc/NEWS index 7dde481a86..d22d038d96 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -96,6 +96,8 @@ C API Library ------- +- Issue #3800: fix filter() related bug in formatter.py. + - Issue #874900: fix behaviour of threading module after a fork. - Issue #3535: zipfile couldn't read some zip files larger than 2GB.