__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

aptanhua@216.73.216.78: ~ $
"""
Testing initialstub throwing an already started exception.
"""

import greenlet

a = None
b = None
c = None
main = greenlet.getcurrent()

# If we switch into a dead greenlet,
# we go looking for its parents.
# if a parent is not yet started, we start it.

results = []

def a_run(*args):
    #results.append('A')
    results.append(('Begin A', args))


def c_run():
    results.append('Begin C')
    b.switch('From C')
    results.append('C done')

class A(greenlet.greenlet): pass

class B(greenlet.greenlet):
    doing_it = False
    def __getattribute__(self, name):
        if name == 'run' and not self.doing_it:
            assert greenlet.getcurrent() is c
            self.doing_it = True
            results.append('Switch to b from B.__getattribute__ in '
                           + type(greenlet.getcurrent()).__name__)
            b.switch()
            results.append('B.__getattribute__ back from main in '
                           + type(greenlet.getcurrent()).__name__)
        if name == 'run':
            name = '_B_run'
        return object.__getattribute__(self, name)

    def _B_run(self, *arg):
        results.append(('Begin B', arg))
        results.append('_B_run switching to main')
        main.switch('From B')

class C(greenlet.greenlet):
    pass
a = A(a_run)
b = B(parent=a)
c = C(c_run, b)

# Start a child; while running, it will start B,
# but starting B will ALSO start B.
result = c.switch()
results.append(('main from c', result))

# Switch back to C, which was in the middle of switching
# already. This will throw the ``GreenletStartedWhileInPython``
# exception, which results in parent A getting started (B is finished)
c.switch()

results.append(('A dead?', a.dead, 'B dead?', b.dead, 'C dead?', c.dead))

# A and B should both be dead now.
assert a.dead
assert b.dead
assert not c.dead

result = c.switch()
results.append(('main from c.2', result))
# Now C is dead
assert c.dead

print("RESULTS:", results)

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 9.51 KB 0644
_test_extension.c File 7.07 KB 0644
_test_extension.cpython-312-x86_64-linux-gnu.so File 16.92 KB 0755
_test_extension_cpp.cpp File 6.56 KB 0644
_test_extension_cpp.cpython-312-x86_64-linux-gnu.so File 57.35 KB 0755
fail_clearing_run_switches.py File 1.23 KB 0644
fail_cpp_exception.py File 985 B 0644
fail_initialstub_already_started.py File 1.92 KB 0644
fail_slp_switch.py File 524 B 0644
fail_switch_three_greenlets.py File 956 B 0644
fail_switch_three_greenlets2.py File 1.25 KB 0644
fail_switch_two_greenlets.py File 817 B 0644
leakcheck.py File 12.32 KB 0644
test_contextvars.py File 9.34 KB 0644
test_cpp.py File 3.09 KB 0644
test_extension_interface.py File 4.71 KB 0644
test_gc.py File 2.85 KB 0644
test_generator.py File 1.21 KB 0644
test_generator_nested.py File 3.63 KB 0644
test_greenlet.py File 49.31 KB 0644
test_greenlet_trash.py File 8.17 KB 0644
test_interpreter_shutdown.py File 32.29 KB 0644
test_leaks.py File 18.79 KB 0644
test_stack_saved.py File 446 B 0644
test_throw.py File 3.63 KB 0644
test_tracing.py File 8.35 KB 0644
test_version.py File 1.49 KB 0644
test_weakref.py File 883 B 0644