Skip to content

Implement free variable capture #36

@alex-sherman

Description

@alex-sherman

Motivated by the use of module global variables, like logging.Logger instances, deco should be able to detect free variable reference in its concurrent functions and pass in/proxy any it encounters. This functionality should be optional, perhaps even allowing the specification of exactly which free variables to capture.

A simple test is the following:

from deco import *

global_var = False

@concurrent
def my_conc():
    return global_var

if __name__ == '__main__':
    global_var = True
    result = my_conc().get()
    print(result) #Should print True, but prints False unless using concurrent.threaded

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