Skip to content

Fix async keyword overrides in add_kwargs - #987

Open
laulauraluo wants to merge 1 commit into
ets-labs:developfrom
laulauraluo:fix/async-keyword-override
Open

laulauraluo wants to merge 1 commit into
ets-labs:developfrom
laulauraluo:fix/async-keyword-override

Conversation

@laulauraluo

Copy link
Copy Markdown

Fixes #974.

Problem

Calling add_kwargs() with an existing name leaves both injections registered. If the earlier dependency is asynchronous, its completed value can overwrite the replacement. The superseded dependency also still runs.

Fix

Merge the existing keyword mapping and reuse set_kwargs() so each name has one injection. Covers Callable, Factory and Singleton, including call-time overrides and superseded dependency side effects. Related prior proposal: #982; this change is limited to Callable keyword registration.

Validation

  • Native regression before the fix: 6 failed, 3 passed.
  • Rebuilt Cython extension; scoped make test: 441 passed, independently repeated.
  • make check: Flake8, pydocstyle and mypy passed.

Tested on macOS/Python 3.12. A local test-runner workaround disabled a broken readline import before collection; provider behavior was not mocked. The full test suite and other platforms were not run.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant