Skip to content

Fix stub errors in hwaccel, error, and ThreadType - #2462

Merged
WyattBlue merged 1 commit into
masterfrom
stub-fixes
Oct 24, 2026
Merged

WyattBlue merged 1 commit into
masterfrom
stub-fixes

Conversation

@WyattBlue

Copy link
Copy Markdown
Member

Fixes these stubtest errors:

av.codec.hwaccel.HWAccel.codec is not present in stub
av.error.ErrorType is not present in stub
av.error.__all__ is not present in stub
av.codec.context.ThreadType.__get__ is not present at runtime
av.codec.context.ThreadType.__set__ is not present at runtime
  • HWAccel.codec: nothing ever assigned this field, so it was always None. Removed it from hwaccel.pxd rather than stubbing it.
  • ErrorType: added the enum, its tag/strerror properties, and __all__ to error.pyi.
  • ThreadType: the stub gave ThreadType fake __get__/__set__ methods so that ctx.thread_type = "AUTO" would type-check. thread_type on CodecContext and VideoStream is now a property whose setter accepts int | str | ThreadType, matching the runtime setter.

VideoStream forwards thread_type to its codec context, so stubtest now reports VideoStream.thread_type is not present at runtime. Keeping it as a plain annotation would break stream.thread_type = "AUTO" under mypy.

- Remove unused `HWAccel.codec` field, which was never assigned
- Add `ErrorType` and `__all__` to `av/error.pyi`
- Stub `thread_type` as a property instead of giving `ThreadType` fake `__get__`/`__set__` methods
@WyattBlue
WyattBlue merged commit 81ed214 into master Oct 24, 2026
8 of 9 checks passed
@WyattBlue
WyattBlue deleted the stub-fixes branch October 24, 2026 03:56
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