Server IP : 85.214.239.14 / Your IP : 3.145.54.210 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /srv/modoboa/env/lib64/python3.5/site-packages/gevent/tests/ |
Upload File : |
# 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 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 attr = _inner_lock(handler.lock) if attr is None and ignore_none: continue assert isinstance(attr, kind), (handler.lock, attr, kind) attr = _inner_lock(logging._lock) if attr is None and ignore_none: return assert isinstance(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)