@contextlib.contextmanager
def frequent_thread_switches():
 interval = None
 if (not sys.platform.startswith('java')):
  if hasattr(sys, 'getswitchinterval'):
   interval = sys.getswitchinterval()
   sys.setswitchinterval(1e-06)
  else:
   interval = sys.getcheckinterval()
   sys.setcheckinterval(1)
 try:
  (yield)
 finally:
  if (not sys.platform.startswith('java')):
   if hasattr(sys, 'setswitchinterval'):
    sys.setswitchinterval(interval)
   else:
    sys.setcheckinterval(interval)

@ contextlib . contextmanager def frequent_thread_switches ( ) : interval = None if ( not sys . platform . startswith ( 'java' ) ) : if hasattr ( sys , 'getswitchinterval' ) : interval = sys . getswitchinterval ( ) sys . setswitchinterval ( 1e-06 ) else : interval = sys . getcheckinterval ( ) sys . setcheckinterval ( 1 ) try : ( yield ) finally : if ( not sys . platform . startswith ( 'java' ) ) : if hasattr ( sys , 'setswitchinterval' ) : sys . setswitchinterval ( interval ) else : sys . setcheckinterval ( interval )
make concurrency bugs more likely to manifest .