Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

In finish(), test if chunk is None rather than using truthiness to de…


whether to call write().

This fixes a discrepancy between finish() and write() when outputting json.
Now both write({}) and finish({}) will output an empty json object.
  • Loading branch information...
commit 45f76c518eaf032c40fd39cc1384577742e5dd4d 1 parent 8637a73
Ben Darnell authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  tornado/
2  tornado/
@@ -463,7 +463,7 @@ def flush(self, include_footers=False):
def finish(self, chunk=None):
"""Finishes this response, ending the HTTP request."""
assert not self._finished
- if chunk: self.write(chunk)
+ if chunk is not None: self.write(chunk)
# Automatically support ETags and add the Content-Length header if
# we have not flushed any content yet.
Please sign in to comment.
Something went wrong with that request. Please try again.