[Piglit] [PATCH 05/20] framework: Make queue import Python 3.x compatible.

Jon Severinsson jon at severinsson.net
Wed Apr 17 09:14:44 PDT 2013


First, we can try to import the Python 3.x name.  If that fails, we can
try the Python 2.x name.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 framework/threadpool.py |    6 +++++-
 1 fil ändrad, 5 tillägg(+), 1 borttagning(-)

diff --git a/framework/threadpool.py b/framework/threadpool.py
index 1500a98..c46e04b 100644
--- a/framework/threadpool.py
+++ b/framework/threadpool.py
@@ -52,9 +52,13 @@ __license__ = "MIT license"
 # standard library modules
 import sys
 import threading
-import Queue as queue
 import traceback
 
+try:
+    import queue
+except ImportError:
+    import Queue as queue
+
 
 # exceptions
 class NoResultsPending(Exception):
-- 
1.7.10.4



More information about the Piglit mailing list