fix(internal): shared mutable default arguments and type identity comparisons - #19808
fix(internal): shared mutable default arguments and type identity comparisons#19808harshadkhetpal wants to merge 1 commit into
Conversation
…parisons Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 594a0b9b2a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| product: "RemoteConfigProduct", | ||
| callback: RCCallback, | ||
| capabilities: "Iterable[RemoteConfigCapabilities]" = [], | ||
| capabilities: "Iterable[RemoteConfigCapabilities]" = (), |
There was a problem hiding this comment.
Update the documented callback default
Changing this introspectable default to () leaves the RemoteConfigPoller API guide at ddtrace/internal/README.md:140 advertising register_callback(product, callback, capabilities=[]). Update that signature so maintainers following the internal guide see the actual contract.
AGENTS.md reference: AGENTS.md:L17-L17
Useful? React with 👍 / 👎.
Summary
Small correctness fixes in
ddtrace/internal/(ruff B006/E721), no behavior change:http.py—request(..., headers={}): mutable shared default on a hot path. Changed toheaders=Nonewith_headers = dict(headers or {})(was already copied, so semantics identical).remoteconfig/worker.py—register_callback(..., capabilities=[])→= (): the annotation isIterable, so an immutable empty tuple satisfies it with zero call-site changes and removes the shared-list hazard.gitmetadata.py— twotype(x) != str→is not str(identity is the intended semantics for type objects).encoding.py—type(err) == bool→is bool(same intent, E721-clean; deliberately notisinstanceto preserve the exact-type check that excludes int).Checklist notes
Lint-only/internal hygiene — no user-facing behavior change, so presumably
no-changelog; happy to add a release note if maintainers prefer.python -m py_compileandruff check --select B006,E721pass on all four files.🤖 Generated with Claude Code