Skip to content

functions with body wipe context.extra #186

@gdementen

Description

@gdementen

If there is in the same expression a call to a function with a body and any EvaluableExpression (which gets stored in extra, eg periodic globals, __getitem__ or attribute access), it breaks, because it first evaluates the EvalableExpression, stores it in .extra then calls the function, which wipes .extra and then by the time we try go evaluate the "larger" expression, we can't find the variable storing the EvaluableExpression result.

entities:
    test:
        processes:
            generate:
                - new('test', number=1000)

            f1(a):
                - return a + 1
            f2(a):
                - r: a + 1
                - return r

            test_issue:
                # works
                - y: id[0]
                - z: y + f2(1)
                - z: id[0] + f1(1)
                # fails
                - z: id[0] + f2(1)

simulation:
    processes:
        - test: [generate, test_issue]
    input:
        method: void
        file: none
    output:
        file: output.h5
    start_period: 2015
    periods: 1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions