Skip to content

leaving .error and .value alive after unwrap results in unnecessary refcycles or potentially large values remaining alive longer than needed #47

@graingert

Description

@graingert

currently unwraping exceptions leaves a refcycle that keeps the entire traceback and any locals alive. This is resolved by clearing the error field when the Error is unwrapped.

For the previous behaviour of Value (eg in trio) if you receive a large bytes object in a Value that bytes object stays alive long after it's needed. Consider a large block of utf8 text that's decoded. The utf8 binary remains alive at the same time as the decoded text object until the next await ... point. This is resolved by clearing the value field when the Value is unwrapped.

this is a breaking change and should probably be released with a major version bump, eg outcome==2.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions