Encode device parameter before channel retrieval

Fixed an issue in the `get_channels_for_device` function where the input
device name wasn't being encoded before passing it to the underlying C
function `getChannelsFromInfo`. This change ensures compatibility with
the expected string encoding, preventing potential runtime errors
related to string handling across the Python-C boundary.
This commit is contained in:
Kumi 2024-02-17 18:06:55 +01:00
parent 8874795fd0
commit fc536126bc
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -724,5 +724,5 @@ def get_device_list():
return [device.decode('utf-8') for device in devices]
def get_channels_for_device(device = ""):
cdef pair[int, int] channels = getChannelsFromInfo(device)
cdef pair[int, int] channels = getChannelsFromInfo(device.encode())
return channels.first, channels.second