Skip to content

[Codec] TypeError: Expected list, got tuple #2153

@ladaapp

Description

@ladaapp

Hi, when installing PyAV from source I can trigger this bug (not reproducible on latest version 16.1..0)

Python 3.13.11 (main, Dec 17 2025, 21:08:16) [Clang 21.1.4 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import av
>>> c=av.codec.Codec('libx264', 'w')
>>> c.hardware_configs
ret [] type <class 'list'>
Traceback (most recent call last):
  File "<python-input-2>", line 1, in <module>
    c.hardware_configs
  File "av/codec/codec.py", line 249, in av.codec.codec.Codec.hardware_configs.__get__
    ret = tuple(ret)
    ^^^
TypeError: Expected list, got tuple

So for some reason reassigning ret from a list to tuple doesn't work. Looks like this was introduced with recent cython changes in that file.

This change fixes it for me but you might have a better understanding of why the above fails and can fix it in a better way (I don't know cython)

-        ret = tuple(ret)
-        self._hardware_configs = ret
-        return ret
+        self._hardware_configs = tuple(ret)
+        return self._hardware_configs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions