summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsk Solem <ask@celeryproject.org>2013-03-12 17:12:06 +0000
committerAsk Solem <ask@celeryproject.org>2013-03-12 17:12:06 +0000
commit065fe664de9f18b6d1773ac5531d6049b1ef0771 (patch)
treebcc43f780933c993ac5b2b4f0ec64764c360d6bd
parent5413e96df8f492108b3bf9b1ca791153a1a8fab4 (diff)
parentcf415ac013e61bec5af0fed481567d0b61c3f154 (diff)
downloadkombu-065fe664de9f18b6d1773ac5531d6049b1ef0771.tar.gz
Merge branch '2.5'
Conflicts: kombu/connection.py
-rw-r--r--kombu/connection.py2
-rw-r--r--kombu/utils/compat.py17
-rw-r--r--kombu/utils/eventio.py16
3 files changed, 20 insertions, 15 deletions
diff --git a/kombu/connection.py b/kombu/connection.py
index fa4c1c54..d9f11bb4 100644
--- a/kombu/connection.py
+++ b/kombu/connection.py
@@ -27,7 +27,7 @@ from .five import Empty, range, string_t, text_t, LifoQueue as _LifoQueue
from .log import get_logger
from .transport import get_transport_cls, supports_librabbitmq
from .utils import cached_property, retry_over_time, shufflecycle
-from .utils.compat import OrderedDict
+from .utils.compat import OrderedDict, get_errno
from .utils.functional import promise
from .utils.url import parse_url
diff --git a/kombu/utils/compat.py b/kombu/utils/compat.py
index a2f2e984..b6e984b2 100644
--- a/kombu/utils/compat.py
+++ b/kombu/utils/compat.py
@@ -7,6 +7,23 @@ Helps compatibility with older Python versions.
"""
from __future__ import absolute_import
+############## socket.error.errno ############################################
+
+
+def get_errno(exc):
+ """:exc:`socket.error` and :exc:`IOError` first got
+ the ``.errno`` attribute in Py2.7"""
+ try:
+ return exc.errno
+ except AttributeError:
+ try:
+ # e.args = (errno, reason)
+ if isinstance(exc.args, tuple) and len(exc.args) == 2:
+ return exc.args[0]
+ except AttributeError:
+ pass
+ return 0
+
############## collections.OrderedDict #######################################
try:
from collections import OrderedDict
diff --git a/kombu/utils/eventio.py b/kombu/utils/eventio.py
index b15a7a4a..2bd23c5b 100644
--- a/kombu/utils/eventio.py
+++ b/kombu/utils/eventio.py
@@ -45,6 +45,8 @@ except ImportError:
from kombu.syn import detect_environment
+from .compat import get_errno
+
__all__ = ['poll']
READ = POLL_READ = 0x001
@@ -52,20 +54,6 @@ WRITE = POLL_WRITE = 0x004
ERR = POLL_ERR = 0x008 | 0x010
-def get_errno(exc):
- """:exc:`socket.error` first got the ``.errno`` attribute in Py2.7"""
- try:
- return exc.errno
- except AttributeError:
- try:
- # e.args = (errno, reason)
- if isinstance(exc.args, tuple) and len(exc.args) == 2:
- return exc.args[0]
- except AttributeError:
- pass
- return 0
-
-
class Poller(object):
def poll(self, timeout):