[Python-modules-commits] [kombu] 01/03: Fix uuid shim in upcoming Python 3.5.1.
Brian May
bam at moszumanska.debian.org
Sat Nov 28 22:43:28 UTC 2015
This is an automated email from the git hooks/post-receive script.
bam pushed a commit to branch master
in repository kombu.
commit 77024a20a3f3f5732116bebe5be0980dd7352310
Author: Kai Groner <kai at gronr.com>
Date: Tue Nov 17 13:15:16 2015 -0500
Fix uuid shim in upcoming Python 3.5.1.
After a recent change in cpython, uuid._uuid_generate_random() no longer
exists.
https://hg.python.org/cpython/rev/70be1f9c9255
http://bugs.python.org/issue25515
The issue being worked around was resolved in 2007, so it might be
sensible to just remove the work around.
---
kombu/utils/__init__.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/kombu/utils/__init__.py b/kombu/utils/__init__.py
index 0745ddf..76779b0 100644
--- a/kombu/utils/__init__.py
+++ b/kombu/utils/__init__.py
@@ -16,7 +16,11 @@ from contextlib import contextmanager
from itertools import count, repeat
from functools import wraps
from time import sleep
-from uuid import UUID, uuid4 as _uuid4, _uuid_generate_random
+from uuid import UUID, uuid4
+try:
+ from uuid import _uuid_generate_random
+except ImportError:
+ _uuid_generate_random = None
from kombu.five import items, reraise, string_t
@@ -140,13 +144,12 @@ def say(m, *fargs, **fkwargs):
print(str(m).format(*fargs, **fkwargs), file=sys.stderr)
-def uuid4():
- # Workaround for http://bugs.python.org/issue4607
- if ctypes and _uuid_generate_random: # pragma: no cover
+if ctypes and _uuid_generate_random: # pragma: no cover
+ def uuid4():
+ # Workaround for http://bugs.python.org/issue4607
buffer = ctypes.create_string_buffer(16)
_uuid_generate_random(buffer)
return UUID(bytes=buffer.raw)
- return _uuid4()
def uuid():
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/kombu.git
More information about the Python-modules-commits
mailing list