Skip to content

Unexpected resolution for passed parameters #64

@aikidojohn

Description

@aikidojohn

When some, but not all, parameters are passed to a kink wrapped function, all parameters are resolved. This includes the passed parameters. This unexpected resolution can lead to unexpected behaviors and errors.

I ran into this while integrating Kink into a complex codebase. The codebase already has a large test suite that I didn't intend to update right away. Unfortunately there were some errors caused by the way Kink handles passed parameters.

We have many classes that take in some constructor arguments and have others defaulted. The tests would often not pass in the defaulted parameters - only the required ones. So in a case like this, the required parameters are mocked and passed in, but since len(passed_parameters) != len(constructor_parmeters), kink does parameter resolution for ALL parameters including passed parameters. This caused errors and unexpected behavior in the test suite since some of the objects being constructed are poorly behaved and have side-effects on construction (not ideal, but a real world situation).

I have provided a potential fix here: #63

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