import thread
import libxml2
class ErrorHandler:
def getLineNumbersDefault():
return old
global failed
# check a per thread-global
failed = 1
print "FAILED to obtain correct value for " \
# check ther global error handler
# (which is NOT per-thread in the python bindings)
try:
except:
pass
else:
assert "failed"
# global error handler
# set on the main thread only
test(1)
if ec == 0:
print "FAILED: should have obtained errors"
ts = []
for i in range(THREADS_COUNT):
# expect 0 for lineNumbersDefault because
# the new value has been set on the main thread only
for t in ts:
t.start()
for t in ts:
t.join()
print "FAILED: did not obtain the correct number of errors"
# set lineNumbersDefault for future new threads
ts = []
for i in range(THREADS_COUNT):
# expect 1 for lineNumbersDefault
for t in ts:
t.start()
for t in ts:
t.join()
print "FAILED: did not obtain the correct number of errors"
if failed:
print "FAILED"
# Memory debug specific
print "OK"
else: