✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ server366.web-hosting.com ​🇻​♯➤ 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP 🇾​♯➤ 2025

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 67.223.118.204 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.217.62
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ 𝗔𝗟𝗟 𝗪𝗢𝗥𝗞𝗜𝗡𝗚....

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /opt/hc_python/lib/python3.12/site-packages/greenlet/tests//test_cpp.py
import gc
import subprocess
import unittest

import greenlet
import objgraph

from . import WIN
from . import TestCase
from . import _test_extension_cpp


class CPPTests(TestCase):
    def test_exception_switch(self):
        greenlets = []
        for i in range(4):
            g = greenlet.greenlet(_test_extension_cpp.test_exception_switch)
            g.switch(i)
            greenlets.append(g)
        for i, g in enumerate(greenlets):
            self.assertEqual(g.switch(), i)

    def _do_test_unhandled_exception(self, target):
        import os
        import sys
        script = os.path.join(
            os.path.dirname(__file__),
            'fail_cpp_exception.py',
        )
        args = [sys.executable, script, target.__name__ if not isinstance(target, str) else target]
        __traceback_info__ = args
        with self.assertRaises(subprocess.CalledProcessError) as exc:
            subprocess.check_output(
                args,
                encoding='utf-8',
                stderr=subprocess.STDOUT
            )

        ex = exc.exception
        expected_exit = self.get_expected_returncodes_for_aborted_process()
        self.assertIn(ex.returncode, expected_exit)
        self.assertIn('fail_cpp_exception is running', ex.output)
        return ex.output


    def test_unhandled_nonstd_exception_aborts(self):
        # verify that plain unhandled throw aborts
        self._do_test_unhandled_exception(_test_extension_cpp.test_exception_throw_nonstd)

    def test_unhandled_std_exception_aborts(self):
        # verify that plain unhandled throw aborts
        self._do_test_unhandled_exception(_test_extension_cpp.test_exception_throw_std)

    @unittest.skipIf(WIN, "XXX: This does not crash on Windows")
    # Meaning the exception is getting lost somewhere...
    def test_unhandled_std_exception_as_greenlet_function_aborts(self):
        # verify that plain unhandled throw aborts
        output = self._do_test_unhandled_exception('run_as_greenlet_target')
        self.assertIn(
            # We really expect this to be prefixed with "greenlet: Unhandled C++ exception:"
            # as added by our handler for std::exception (see TUserGreenlet.cpp), but
            # that's not correct everywhere --- our handler never runs before std::terminate
            # gets called (for example, on arm32).
            'Thrown from an extension.',
            output
        )

    def test_unhandled_exception_in_greenlet_aborts(self):
        # verify that unhandled throw called in greenlet aborts too
        self._do_test_unhandled_exception('run_unhandled_exception_in_greenlet_aborts')


    def test_leak_test_exception_switch_and_do_in_g2(self):
        def raiser():
            raise ValueError("boom")

        gc.collect()
        before = objgraph.count("greenlet")

        for _ in range(1000):
            with self.assertRaises(ValueError):
                _test_extension_cpp.test_exception_switch_and_do_in_g2(raiser)

        gc.collect()
        after = objgraph.count("greenlet")
        leaked = after - before
        self.assertEqual(0, leaked)


if __name__ == '__main__':
    unittest.main()


Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
11 Jun 2026 5.00 AM
root / root
0755
__pycache__
--
11 Jun 2026 5.00 AM
root / root
0755
__init__.py
9.508 KB
11 Jun 2026 5.00 AM
root / root
0644
_test_extension.c
7.074 KB
11 Jun 2026 5.00 AM
root / root
0644
_test_extension.cpython-312-x86_64-linux-gnu.so
16.922 KB
11 Jun 2026 5.00 AM
root / root
0755
_test_extension_cpp.cpp
6.556 KB
11 Jun 2026 5.00 AM
root / root
0644
_test_extension_cpp.cpython-312-x86_64-linux-gnu.so
57.352 KB
11 Jun 2026 5.00 AM
root / root
0755
fail_clearing_run_switches.py
1.233 KB
11 Jun 2026 5.00 AM
root / root
0644
fail_cpp_exception.py
0.962 KB
11 Jun 2026 5.00 AM
root / root
0644
fail_initialstub_already_started.py
1.915 KB
11 Jun 2026 5.00 AM
root / root
0644
fail_slp_switch.py
0.512 KB
11 Jun 2026 5.00 AM
root / root
0644
fail_switch_three_greenlets.py
0.934 KB
11 Jun 2026 5.00 AM
root / root
0644
fail_switch_three_greenlets2.py
1.255 KB
11 Jun 2026 5.00 AM
root / root
0644
fail_switch_two_greenlets.py
0.798 KB
11 Jun 2026 5.00 AM
root / root
0644
leakcheck.py
12.317 KB
11 Jun 2026 5.00 AM
root / root
0644
test_contextvars.py
9.34 KB
11 Jun 2026 5.00 AM
root / root
0644
test_cpp.py
3.09 KB
11 Jun 2026 5.00 AM
root / root
0644
test_extension_interface.py
4.707 KB
11 Jun 2026 5.00 AM
root / root
0644
test_gc.py
2.854 KB
11 Jun 2026 5.00 AM
root / root
0644
test_generator.py
1.211 KB
11 Jun 2026 5.00 AM
root / root
0644
test_generator_nested.py
3.631 KB
11 Jun 2026 5.00 AM
root / root
0644
test_greenlet.py
49.312 KB
11 Jun 2026 5.00 AM
root / root
0644
test_greenlet_trash.py
8.173 KB
11 Jun 2026 5.00 AM
root / root
0644
test_interpreter_shutdown.py
32.29 KB
11 Jun 2026 5.00 AM
root / root
0644
test_leaks.py
18.791 KB
11 Jun 2026 5.00 AM
root / root
0644
test_stack_saved.py
0.436 KB
11 Jun 2026 5.00 AM
root / root
0644
test_throw.py
3.625 KB
11 Jun 2026 5.00 AM
root / root
0644
test_tracing.py
8.353 KB
11 Jun 2026 5.00 AM
root / root
0644
test_version.py
1.492 KB
11 Jun 2026 5.00 AM
root / root
0644
test_weakref.py
0.862 KB
11 Jun 2026 5.00 AM
root / root
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF