Skip to content

fix(internal): shared mutable default arguments and type identity comparisons - #19808

Open
harshadkhetpal wants to merge 1 commit into
DataDog:mainfrom
harshadkhetpal:fix/internal-lint-correctness
Open

fix(internal): shared mutable default arguments and type identity comparisons#19808
harshadkhetpal wants to merge 1 commit into
DataDog:mainfrom
harshadkhetpal:fix/internal-lint-correctness

Conversation

@harshadkhetpal

Copy link
Copy Markdown

Summary

Small correctness fixes in ddtrace/internal/ (ruff B006/E721), no behavior change:

  1. http.pyrequest(..., headers={}): mutable shared default on a hot path. Changed to headers=None with _headers = dict(headers or {}) (was already copied, so semantics identical).
  2. remoteconfig/worker.pyregister_callback(..., capabilities=[])= (): the annotation is Iterable, so an immutable empty tuple satisfies it with zero call-site changes and removes the shared-list hazard.
  3. gitmetadata.py — two type(x) != stris not str (identity is the intended semantics for type objects).
  4. encoding.pytype(err) == boolis bool (same intent, E721-clean; deliberately not isinstance to 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_compile and ruff check --select B006,E721 pass on all four files.

🤖 Generated with Claude Code

…parisons

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@harshadkhetpal
harshadkhetpal requested review from a team as code owners August 21, 2026 09:53
@harshadkhetpal
harshadkhetpal requested a review from juanjux August 21, 2026 09:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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]" = (),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

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.

2 participants