[Piglit] [PATCH 5/6] framework: Make queue import Python 3.x compatible.

Kenneth Graunke kenneth at whitecape.org
Wed Apr 17 02:53:57 PDT 2013


From: Jon Severinsson <jon at severinsson.net>

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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/framework/threadpool.py b/framework/threadpool.py
index 1500a98..6bb13d7 100644
--- a/framework/threadpool.py
+++ b/framework/threadpool.py
@@ -52,9 +52,12 @@ __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.8.2.1



More information about the Piglit mailing list