opt
/
hc_python
/
lib
/
python3.12
/
site-packages
/
greenlet
/
tests
/
Go to Home Directory
+
Upload
Create File
root@0UT1S:~$
Execute
By Order of Mr.0UT1S
[DIR] ..
N/A
[DIR] __pycache__
N/A
__init__.py
9.03 KB
Rename
Delete
_test_extension.c
5.64 KB
Rename
Delete
_test_extension.cpython-312-x86_64-linux-gnu.so
36.30 KB
Rename
Delete
_test_extension_cpp.cpp
6.41 KB
Rename
Delete
_test_extension_cpp.cpython-312-x86_64-linux-gnu.so
56.45 KB
Rename
Delete
fail_clearing_run_switches.py
1.23 KB
Rename
Delete
fail_cpp_exception.py
985 bytes
Rename
Delete
fail_initialstub_already_started.py
1.92 KB
Rename
Delete
fail_slp_switch.py
524 bytes
Rename
Delete
fail_switch_three_greenlets.py
956 bytes
Rename
Delete
fail_switch_three_greenlets2.py
1.25 KB
Rename
Delete
fail_switch_two_greenlets.py
817 bytes
Rename
Delete
leakcheck.py
11.68 KB
Rename
Delete
test_contextvars.py
10.11 KB
Rename
Delete
test_cpp.py
2.67 KB
Rename
Delete
test_extension_interface.py
3.74 KB
Rename
Delete
test_gc.py
2.85 KB
Rename
Delete
test_generator.py
1.21 KB
Rename
Delete
test_generator_nested.py
3.63 KB
Rename
Delete
test_greenlet.py
44.91 KB
Rename
Delete
test_greenlet_trash.py
7.76 KB
Rename
Delete
test_leaks.py
17.06 KB
Rename
Delete
test_stack_saved.py
446 bytes
Rename
Delete
test_throw.py
3.63 KB
Rename
Delete
test_tracing.py
8.06 KB
Rename
Delete
test_version.py
1.31 KB
Rename
Delete
test_weakref.py
883 bytes
Rename
Delete
""" Uses a trace function to switch greenlets at unexpected times. In the trace function, we switch from the current greenlet to another greenlet, which switches """ import greenlet g1 = None g2 = None switch_to_g2 = False def tracefunc(*args): print('TRACE', *args) global switch_to_g2 if switch_to_g2: switch_to_g2 = False g2.switch() print('\tLEAVE TRACE', *args) def g1_run(): print('In g1_run') global switch_to_g2 switch_to_g2 = True from_parent = greenlet.getcurrent().parent.switch() print('Return to g1_run') print('From parent', from_parent) def g2_run(): #g1.switch() greenlet.getcurrent().parent.switch() greenlet.settrace(tracefunc) g1 = greenlet.greenlet(g1_run) g2 = greenlet.greenlet(g2_run) # This switch didn't actually finish! # And if it did, it would raise TypeError # because g1_run() doesn't take any arguments. g1.switch(1) print('Back in main') g1.switch(2)
Save