From 951a41ce57bd853947f842028bccb500bd5237da Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Wed, 14 May 2014 01:19:51 -0600 Subject: [PATCH] Check for None explicitly instead of truthiness 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. --- webob/response.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webob/response.py b/webob/response.py index 8582c44b..b30a7fd3 100644 --- a/webob/response.py +++ b/webob/response.py @@ -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):