%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
# If the logging module is imported *before* monkey patching,
# the existing handlers are correctly monkey patched to use gevent locks
import logging
logging.basicConfig()
import threading
import sys
PY2 = sys.version_info[0] == 2
def _inner_lock(lock):
# The inner attribute changed between 2 and 3
attr = getattr(lock, '_block' if not PY2 else '_RLock__block', None)
return attr
def _check_type(root, lock, inner_semaphore, kind):
if not isinstance(inner_semaphore, kind):
raise AssertionError(
"Expected <object>.[_]lock._block to be of type %s, "
"but it was of type %s.\n"
"\t<object>.[_]lock=%r\n"
"\t<object>.[_]lock._block=%r\n"
"\t<object>=%r" % (
kind,
type(inner_semaphore),
lock,
inner_semaphore,
root
)
)
def checkLocks(kind, ignore_none=True):
handlers = logging._handlerList
assert handlers
for weakref in handlers:
# In py26, these are actual handlers, not weakrefs
handler = weakref() if callable(weakref) else weakref
block = _inner_lock(handler.lock)
if block is None and ignore_none:
continue
_check_type(handler, handler.lock, block, kind)
attr = _inner_lock(logging._lock)
if attr is None and ignore_none:
return
_check_type(logging, logging._lock, attr, kind)
checkLocks(type(threading._allocate_lock()))
import gevent.monkey
gevent.monkey.patch_all()
import gevent.lock
checkLocks(type(gevent.thread.allocate_lock()), ignore_none=False)