]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Allow tuples for the IOStream.close exc_info argument.
authorBen Darnell <ben@bendarnell.com>
Sat, 22 Dec 2012 17:08:03 +0000 (12:08 -0500)
committerBen Darnell <ben@bendarnell.com>
Sat, 22 Dec 2012 17:08:03 +0000 (12:08 -0500)
Update release notes.

tornado/iostream.py
website/sphinx/releases/next.rst

index 4c2f0d52281e595711b3569aaecbd595638f7bac..6eec2a357429fe536aeb44977c67ae1da508c31c 100644 (file)
@@ -212,12 +212,16 @@ class BaseIOStream(object):
     def close(self, exc_info=False):
         """Close this stream.
 
-        If `exc_info` is true, set the `error` attribute to the current
-        exception from ``sys.exc_info()``.
+        If ``exc_info`` is true, set the ``error`` attribute to the current
+        exception from `sys.exc_info()` (or if ``exc_info`` is a tuple,
+        use that instead of `sys.exc_info`).
         """
         if not self.closed():
-            if exc_info and any(sys.exc_info()):
-                self.error = sys.exc_info()[1]
+            if exc_info:
+                if not isinstance(exc_info, tuple):
+                    exc_info = sys.exc_info()
+                if any(exc_info):
+                    self.error = exc_info[1]
             if self._read_until_close:
                 callback = self._read_callback
                 self._read_callback = None
index 5a07cf61309ad74b312c18f210b3a6ad12bd2871..465572ded7d0c9887cbf5b5dc597883ef403c039 100644 (file)
@@ -204,3 +204,7 @@ In progress
   `Application.add_handlers` call.  Now the request will be matched
   against the handlers for any ``host_pattern`` that includes the request's
   ``Host`` header.
+* `IOStream.error` no longer picks up unrelated exceptions.
+* `IOStream.close` now has an ``exc_info`` argument (similar to the
+  one used in the `logging` module) that can be used to set the stream's
+  ``error`` attribute when closing it.