From fc536126bc922f5b2665521aaad65d7a4f261340 Mon Sep 17 00:00:00 2001 From: Kumi Date: Sat, 17 Feb 2024 18:06:55 +0100 Subject: [PATCH] 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. --- src/limedriver/limedriver.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/limedriver/limedriver.pyx b/src/limedriver/limedriver.pyx index c47e190..039da97 100644 --- a/src/limedriver/limedriver.pyx +++ b/src/limedriver/limedriver.pyx @@ -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