[Python-modules-commits] [django-q] 08/08: Use conditional on a python3-only part of the code

Pierre-Elliott Bécue peb-guest at moszumanska.debian.org
Tue Feb 6 08:37:05 UTC 2018


This is an automated email from the git hooks/post-receive script.

peb-guest pushed a commit to branch patch-queue/master
in repository django-q.

commit cd9fbe7d93b5db88b9d1e07c9711f3f63a7e66fe
Author: Pierre-Elliott Bécue <becue at crans.org>
Date:   Tue Feb 6 09:28:46 2018 +0100

    Use conditional on a python3-only part of the code
---
 django_q/queues.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/django_q/queues.py b/django_q/queues.py
index ad729a1..6466fa2 100644
--- a/django_q/queues.py
+++ b/django_q/queues.py
@@ -2,6 +2,8 @@
 The code is derived from https://github.com/althonos/pronto/commit/3384010dfb4fc7c66a219f59276adef3288a886b
 """
 
+import sys
+
 import multiprocessing
 import multiprocessing.queues
 
@@ -48,7 +50,10 @@ class Queue(multiprocessing.queues.Queue):
     """
 
     def __init__(self, *args, **kwargs):
-        super(Queue, self).__init__(*args, ctx=multiprocessing.get_context(), **kwargs)
+        if sys.version_info < (3, 0):
+            super(Queue, self).__init__(*args, **kwargs)
+        else:
+            super(Queue, self).__init__(*args, ctx=multiprocessing.get_context(), **kwargs)
         self.size = SharedCounter(0)
 
     def put(self, *args, **kwargs):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-q.git



More information about the Python-modules-commits mailing list