Skip to content

Fix some Pyright type errors in Span/ReadableSpan and utility stubs#4973

Merged
xrmx merged 4 commits intoopen-telemetry:mainfrom
emdneto:pyright-sdk-trace
Mar 13, 2026
Merged

Fix some Pyright type errors in Span/ReadableSpan and utility stubs#4973
xrmx merged 4 commits intoopen-telemetry:mainfrom
emdneto:pyright-sdk-trace

Conversation

@emdneto
Copy link
Member

@emdneto emdneto commented Mar 12, 2026

Errors:

opentelemetry-sdk/src/opentelemetry/sdk/trace/init.py:145:59 - error: Function with declared return type "bool" must return value on all code paths "None" is not assignable to "bool" (reportReturnType)
opentelemetry-sdk/src/opentelemetry/sdk/trace/init.py:255:40 - error: Object of type "None" cannot be called (reportOptionalCall)
opentelemetry-sdk/src/opentelemetry/sdk/trace/init.py:864:28 - error: Argument of type "int | None" cannot be assigned to parameter "maxlen" of type "int" in function "init" Type "int | None" is not assignable to type "int" "None" is not assignable to "int" (reportArgumentType)
opentelemetry-sdk/src/opentelemetry/sdk/trace/init.py:868:32 - error: Argument of type "int | None" cannot be assigned to parameter "maxlen" of type "int" in function "init" Type "int | None" is not assignable to type "int" "None" is not assignable to "int" (reportArgumentType)
opentelemetry-sdk/src/opentelemetry/sdk/trace/init.py:881:37 - error: Argument of type "int | None" cannot be assigned to parameter "maxlen" of type "int" in function "from_seq" Type "int | None" is not assignable to type "int" "None" is not assignable to "int" (reportArgumentType)
opentelemetry-sdk/src/opentelemetry/sdk/trace/init.py:883:9 - error: Method "get_span_context" overrides class "Span" in an incompatible manner Return type mismatch: base method returns type "SpanContext", override returns type "SpanContext | None" Type "SpanContext | None" is not assignable to type "SpanContext" "None" is not assignable to "SpanContext" (reportIncompatibleMethodOverride)
opentelemetry-sdk/src/opentelemetry/sdk/trace/init.py:1050:49 - error: "name" is not a known attribute of "None" (reportOptionalMemberAccess)
opentelemetry-sdk/src/opentelemetry/sdk/trace/init.py:1245:23 - error: Argument of type "Sequence[Link] | None" cannot be assigned to parameter "links" of type "Sequence[Link]" in function "init" Type "Sequence[Link] | None" is not assignable to type "Sequence[Link]" "None" is not assignable to "Sequence[Link]" (reportArgumentType)
8 errors, 0 warnings, 0 informations

@emdneto emdneto requested a review from a team as a code owner March 12, 2026 12:05
@emdneto emdneto changed the title Resolve some Pyright type errors in Span/ReadableSpan and utility stubs Fix some Pyright type errors in Span/ReadableSpan and utility stubs Mar 12, 2026
@emdneto emdneto moved this to Easy to review / merge / close in Python PR digest Mar 12, 2026
@xrmx xrmx merged commit 28b6852 into open-telemetry:main Mar 13, 2026
461 checks passed
@github-project-automation github-project-automation bot moved this from Easy to review / merge / close to Done in Python PR digest Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants