X7ROOT File Manager
Current Path:
/opt/hc_python/lib/python3.12/site-packages/greenlet/tests
opt
/
hc_python
/
lib
/
python3.12
/
site-packages
/
greenlet
/
tests
/
ðŸ“
..
📄
__init__.py
(9.14 KB)
ðŸ“
__pycache__
📄
_test_extension.c
(5.64 KB)
📄
_test_extension.cpython-312-x86_64-linux-gnu.so
(16.85 KB)
📄
_test_extension_cpp.cpp
(6.41 KB)
📄
_test_extension_cpp.cpython-312-x86_64-linux-gnu.so
(57.02 KB)
📄
fail_clearing_run_switches.py
(1.23 KB)
📄
fail_cpp_exception.py
(985 B)
📄
fail_initialstub_already_started.py
(1.92 KB)
📄
fail_slp_switch.py
(524 B)
📄
fail_switch_three_greenlets.py
(956 B)
📄
fail_switch_three_greenlets2.py
(1.25 KB)
📄
fail_switch_two_greenlets.py
(817 B)
📄
leakcheck.py
(11.68 KB)
📄
test_contextvars.py
(10.29 KB)
📄
test_cpp.py
(2.67 KB)
📄
test_extension_interface.py
(3.74 KB)
📄
test_gc.py
(2.85 KB)
📄
test_generator.py
(1.21 KB)
📄
test_generator_nested.py
(3.63 KB)
📄
test_greenlet.py
(45.17 KB)
📄
test_greenlet_trash.py
(7.76 KB)
📄
test_leaks.py
(17.3 KB)
📄
test_stack_saved.py
(446 B)
📄
test_throw.py
(3.63 KB)
📄
test_tracing.py
(8.06 KB)
📄
test_version.py
(1.31 KB)
📄
test_weakref.py
(883 B)
Editing: 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)
Upload File
Create Folder