403Webshell
Server IP : 66.29.132.122  /  Your IP : 3.129.210.91
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/self/root/proc/thread-self/root/opt/hc_python/lib64/python3.8/site-packages/greenlet/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/self/root/proc/thread-self/root/opt/hc_python/lib64/python3.8/site-packages/greenlet/tests//fail_switch_three_greenlets2.py
"""
Like fail_switch_three_greenlets, but the call into g1_run would actually be
valid.
"""
import greenlet

g1 = None
g2 = None

switch_to_g2 = True

results = []

def tracefunc(*args):
    results.append(('trace', args[0]))
    print('TRACE', *args)
    global switch_to_g2
    if switch_to_g2:
        switch_to_g2 = False
        g2.switch('g2 from tracefunc')
    print('\tLEAVE TRACE', *args)

def g1_run(arg):
    results.append(('g1 arg', arg))
    print('In g1_run')
    from_parent = greenlet.getcurrent().parent.switch('from g1_run')
    results.append(('g1 from parent', from_parent))
    return 'g1 done'

def g2_run(arg):
    #g1.switch()
    results.append(('g2 arg', arg))
    parent = greenlet.getcurrent().parent.switch('from g2_run')
    global switch_to_g2
    switch_to_g2 = False
    results.append(('g2 from parent', parent))
    return 'g2 done'


greenlet.settrace(tracefunc)

g1 = greenlet.greenlet(g1_run)
g2 = greenlet.greenlet(g2_run)

x = g1.switch('g1 from main')
results.append(('main g1', x))
print('Back in main', x)
x = g1.switch('g2 from main')
results.append(('main g2', x))
print('back in amain again', x)
x = g1.switch('g1 from main 2')
results.append(('main g1.2', x))
x = g2.switch()
results.append(('main g2.2', x))
print("RESULTS:", results)

Youez - 2016 - github.com/yon3zu
LinuXploit