Skip to content

Fix annotation for inspect.BoundArguments.arguments#15853

Open
prasanthcakewalk wants to merge 1 commit into
python:mainfrom
prasanthcakewalk:fix/inspect-BoundArguments-annotation
Open

Fix annotation for inspect.BoundArguments.arguments#15853
prasanthcakewalk wants to merge 1 commit into
python:mainfrom
prasanthcakewalk:fix/inspect-BoundArguments-annotation

Conversation

@prasanthcakewalk
Copy link
Copy Markdown

Fixes a minor issue in the annotations for the inspect.BoundArguments class reported in #15832.

@JelleZijlstra

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Diff from mypy_primer, showing the effect of this PR on open source code:

dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/llmobs/decorators.py:217: error: Argument 1 to "_get_span_inputs" has incompatible type "dict[str, Any]"; expected "OrderedDict[Any, Any]"  [arg-type]
+ ddtrace/llmobs/decorators.py:233: error: Argument 1 to "_get_span_inputs" has incompatible type "dict[str, Any]"; expected "OrderedDict[Any, Any]"  [arg-type]
+ ddtrace/llmobs/decorators.py:254: error: Argument 1 to "_get_span_inputs" has incompatible type "dict[str, Any]"; expected "OrderedDict[Any, Any]"  [arg-type]
+ ddtrace/llmobs/decorators.py:279: error: Argument 1 to "_get_span_inputs" has incompatible type "dict[str, Any]"; expected "OrderedDict[Any, Any]"  [arg-type]

@JelleZijlstra
Copy link
Copy Markdown
Member

The new errors in ddtrace are true positives (but it's an easy fix: just change the annotation on https://github.com/DataDog/dd-trace-py/blob/e92c95792923aad3ae99c5942792e78f71f31cc4/ddtrace/llmobs/decorators.py#L35).

JelleZijlstra added a commit to JelleZijlstra/dd-trace-py that referenced this pull request Jun 2, 2026
This function gets passed the `.args` attribute of the `inspect.BoundArguments` structure, which is in fact a dict, not an OrderedDict. We're fixing this in typeshed python/typeshed#15853; this PR will make it so your type checker won't start emitting errors here when you next update your typeshed.
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