Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7cd67cc

Browse files
committed
Fix formatter usage of filter(). Bug #3800.
1 parent 617027f commit 7cd67cc

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

Lib/formatter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,15 @@ def pop_font(self):
255255

256256
def push_margin(self, margin):
257257
self.margin_stack.append(margin)
258-
fstack = filter(None, self.margin_stack)
258+
fstack = [m for m in self.margin_stack if m]
259259
if not margin and fstack:
260260
margin = fstack[-1]
261261
self.writer.new_margin(margin, len(fstack))
262262

263263
def pop_margin(self):
264264
if self.margin_stack:
265265
del self.margin_stack[-1]
266-
fstack = filter(None, self.margin_stack)
266+
fstack = [m for m in self.margin_stack if m]
267267
if fstack:
268268
margin = fstack[-1]
269269
else:

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ C API
9696
Library
9797
-------
9898

99+
- Issue #3800: fix filter() related bug in formatter.py.
100+
99101
- Issue #874900: fix behaviour of threading module after a fork.
100102

101103
- Issue #3535: zipfile couldn't read some zip files larger than 2GB.

0 commit comments

Comments
 (0)