make all syntax compatible with 3.1 and 2.5

--HG--
branch : trunk
This commit is contained in:
Benjamin Peterson
2009-08-29 13:04:48 -05:00
parent 6f4c6d36a4
commit ee1747fcb4
60 changed files with 230 additions and 177 deletions

View File

@@ -2,6 +2,7 @@ import Queue
import threading
import time
import sys
import py
ERRORMARKER = object()
@@ -52,7 +53,7 @@ class Reply(object):
if result is ERRORMARKER:
self._queue = None
excinfo = self._excinfo
raise excinfo[0], excinfo[1], excinfo[2]
py.builtin._reraise(excinfo[0], excinfo[1], excinfo[2])
return result
class WorkerThread(threading.Thread):

View File

@@ -17,7 +17,7 @@ class TestThreadOut:
try:
l = []
out.setwritefunc(l.append)
print 42,13,
py.builtin.print_(42,13)
x = l.pop(0)
assert x == '42'
x = l.pop(0)
@@ -34,9 +34,9 @@ class TestThreadOut:
defaults = []
def f(l):
out.setwritefunc(l.append)
print id(l),
print(id(l))
out.delwritefunc()
print 1
print(1)
out.setdefaultwriter(defaults.append)
pool = WorkerPool()
listlist = []
@@ -46,7 +46,7 @@ class TestThreadOut:
pool.dispatch(f, l)
pool.shutdown()
for name, value in out.__dict__.items():
print >>sys.stderr, "%s: %s" %(name, value)
sys.stderr.write("%s: %s\n" %(name, value))
pool.join(2.0)
for i in range(num):
item = listlist[i]

View File

@@ -88,6 +88,6 @@ def test_pool_clean_shutdown():
assert not pool._alive
assert not pool._ready
out, err = capture.reset()
print out
print >>sys.stderr, err
print(out)
sys.stderr.write(err + "\n")
assert err == ''