chat-backend/venv/lib/python3.12/site-packages/greenlet/tests/fail_cpp_exception.py
Django Template a0fce0b484 Initial commit: Django chat backend with enhanced web scraping
Features:
- Django REST API backend
- Multi-strategy web scraping system (Beautiful Soup, Playwright, Firecrawl)
- Anti-detection features (proxy rotation, user-agent rotation)
- Data export functionality (JSON, CSV, TXT)
- Business and CrawledPage models
- Enhanced crawling service with fallback mechanisms

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-21 11:01:50 +05:30

34 lines
985 B
Python

# -*- 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()