Skip to content

Cannot use it in a nested manner #19

@zachliu

Description

@zachliu

I'm using it under Python 3.8.4

from time import sleep

from func_timeout import func_set_timeout


@func_set_timeout(1)
def func_1(sec):
    print(f"in func 1, sleeping {sec} sec but will timeout in 1 sec")
    sleep(sec)


@func_set_timeout(1)
def func_2(sec):
    print(f"in func 2, sleeping {sec} sec but will timeout in 1 sec")
    sleep(sec)


@func_set_timeout(5)
def func():
    func_1(2)
    print("in main func")
    func_2(0.3)


if __name__ == "__main__":
    func()

This program would stop at func_1(2) silently
it seems the top level @func_set_timeout(5) swallows all the FunctionTimedOut and doesn't re-raise

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions