Skip to content

Commit

Permalink
Check for None explicitly instead of truthiness
Browse files Browse the repository at this point in the history
If we check for truthines the object itself may return False, which
would mean self.close is not set to app_iter.close, which means that we
may end up leaking.
  • Loading branch information
digitalresistor committed May 14, 2014
1 parent 9e47143 commit 951a41c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion webob/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ class EmptyResponse(object):
"""

def __init__(self, app_iter=None):
if app_iter and hasattr(app_iter, 'close'):
if app_iter is not None and hasattr(app_iter, 'close'):
self.close = app_iter.close

def __iter__(self):
Expand Down

0 comments on commit 951a41c

Please sign in to comment.