Skip to content

Commit 2f0ae88

Browse files
author
Sakis Kasampalis
committed
python 2.x/3.x compatibility change
1 parent 9da776c commit 2f0ae88

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pool.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@ def __del__(self):
2525
self._q.put(self.o)
2626
self.o = None
2727

28-
if __name__ == "__main__":
29-
import Queue
28+
if __name__ == "__main__":
29+
try:
30+
import queue as Queue
31+
except: # python 2.x compatibility
32+
import Queue
3033

3134
def testObj(Q):
3235
someObj = qObj(Q, True)
3336
print('Inside func: {}'.format(someObj.o))
3437

35-
aQ = Queue.Queue()
38+
aQ = Queue.Queue()
3639
aQ.put("yam")
3740

3841
with qObj(aQ) as obj:

0 commit comments

Comments
 (0)