]> git.michaelhowe.org Git - packages/b/bup.git/commitdiff
Update tornado to revision ad104ffb41
authorGabriel Filion <lelutin@gmail.com>
Tue, 20 Jul 2010 22:42:26 +0000 (18:42 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Tue, 20 Jul 2010 22:45:14 +0000 (18:45 -0400)
The file lib/tornado/escape.py was forcing users to install a json
library even though "bup web" doesn't use any json functionality.

An issue was opened upstream:

http://github.com/facebook/tornado/issues/closed#issue/114

and the day after it was opened, a fix was committed for it.

Update to the latest revision of tornado so that we can remove a
dependency on json/simplejson.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
lib/tornado/escape.py
lib/tornado/ioloop.py

index af99f52feb1d2dba4555b8d2901a94c258b801f6..8852ca2958e8a9ef1fbc5e27afd035f33f4b0fc5 100644 (file)
@@ -21,6 +21,8 @@ import re
 import xml.sax.saxutils
 import urllib
 
+# json module is in the standard library as of python 2.6; fall back to
+# simplejson if present for older versions.
 try:
     import json
     assert hasattr(json, "loads") and hasattr(json, "dumps")
@@ -38,8 +40,11 @@ except:
             _json_decode = lambda s: simplejson.loads(_unicode(s))
             _json_encode = lambda v: simplejson.dumps(v)
         except ImportError:
-            raise Exception("A JSON parser is required, e.g., simplejson at "
-                            "http://pypi.python.org/pypi/simplejson/")
+            def _json_decode(s):
+                raise NotImplementedError(
+                    "A JSON parser is required, e.g., simplejson at "
+                    "http://pypi.python.org/pypi/simplejson/")
+            _json_encode = _json_decode
 
 
 def xhtml_escape(value):
index f9bb1a255af798a58cfbfad26951ca4d22455508..c1345cb2f6b81766884886e61010945e10f038a6 100644 (file)
@@ -224,7 +224,14 @@ class IOLoop(object):
             try:
                 event_pairs = self._impl.poll(poll_timeout)
             except Exception, e:
-                if hasattr(e, 'errno') and e.errno == errno.EINTR:
+                # Depending on python version and IOLoop implementation,
+                # different exception types may be thrown and there are
+                # two ways EINTR might be signaled:
+                # * e.errno == errno.EINTR
+                # * e.args is like (errno.EINTR, 'Interrupted system call')
+                if (getattr(e, 'errno') == errno.EINTR or
+                    (isinstance(getattr(e, 'args'), tuple) and
+                     len(e.args) == 2 and e.args[0] == errno.EINTR)):
                     logging.warning("Interrupted system call", exc_info=1)
                     continue
                 else: