PHP 8.3.31
Preview: fail_cpp_exception.py Size: 985 B
/opt/hc_python/lib/python3.12/site-packages/greenlet/tests/fail_cpp_exception.py

# -*- coding: utf-8 -*-
"""
Helper for testing a C++ exception throw aborts the process.

Takes one argument, the name of the function in :mod:`_test_extension_cpp` to call.
"""
import sys
import greenlet
from greenlet.tests import _test_extension_cpp
print('fail_cpp_exception is running')

def run_unhandled_exception_in_greenlet_aborts():
    def _():
        _test_extension_cpp.test_exception_switch_and_do_in_g2(
            _test_extension_cpp.test_exception_throw_nonstd
        )
    g1 = greenlet.greenlet(_)
    g1.switch()


func_name = sys.argv[1]
try:
    func = getattr(_test_extension_cpp, func_name)
except AttributeError:
    if func_name == run_unhandled_exception_in_greenlet_aborts.__name__:
        func = run_unhandled_exception_in_greenlet_aborts
    elif func_name == 'run_as_greenlet_target':
        g = greenlet.greenlet(_test_extension_cpp.test_exception_throw_std)
        func = g.switch
    else:
        raise
print('raising', func, flush=True)
func()

Directory Contents

Dirs: 1 × Files: 28

Name Size Perms Modified Actions
- drwxr-xr-x 2026-06-11 06:30:31
Edit Download
1.23 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
985 B lrw-r--r-- 2026-06-11 06:30:31
Edit Download
1.92 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
524 B lrw-r--r-- 2026-06-11 06:30:31
Edit Download
956 B lrw-r--r-- 2026-06-11 06:30:31
Edit Download
1.25 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
817 B lrw-r--r-- 2026-06-11 06:30:31
Edit Download
12.32 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
9.34 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
3.09 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
4.71 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
2.85 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
1.21 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
3.63 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
49.31 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
8.17 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
32.29 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
18.79 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
446 B lrw-r--r-- 2026-06-11 06:30:31
Edit Download
3.63 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
8.35 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
1.49 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
883 B lrw-r--r-- 2026-06-11 06:30:31
Edit Download
7.07 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
16.92 KB lrwxr-xr-x 2026-06-11 06:30:31
Edit Download
6.56 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download
57.35 KB lrwxr-xr-x 2026-06-11 06:30:31
Edit Download
9.51 KB lrw-r--r-- 2026-06-11 06:30:31
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).