Skip to content

NameError: name '....' is not defined when using @compile_fun #47

@smarie

Description

@smarie

If you use @compile_fun on a function that references other functions defined LATER in the code, you will end up with a NameError. Indeed in that case the names appear in func.__code__.co_names but are not yet present in the eval dictionaries (globals(), locals()).

There is no easy workaround, the best is probably to create your functions in the right order.

See also https://stackoverflow.com/questions/45147260/what-is-co-names

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions