def METHOD_NAME():
    state = []
    @forksafe.register
    def after_in_child():
        raise ValueError
    @forksafe.register
    def state_append_1():
        forksafe.register(state.append(1))
    @forksafe.register
    def state_append_3():
        forksafe.register(state.append(3))
    def f1():
        return state
    def f2():
        return state
    def f3():
        return state
    pid = os.fork()
    if pid == 0:
        # child
        assert f1() == f2() == f3() == [1, 3]
        os._exit(12)
    else:
        assert f1() == f2() == f3() == []
    _, status = os.waitpid(pid, 0)
    exit_code = os.WEXITSTATUS(status)
    assert exit_code == 12