[libcamera-devel,v2,04/13] py: unittests: fix selector fd use
diff mbox series

Message ID 20220517143325.71784-5-tomi.valkeinen@ideasonboard.com
State Superseded
Headers show
Series
  • Misc Python bindings patches
Related show

Commit Message

Tomi Valkeinen May 17, 2022, 2:33 p.m. UTC
pyright complains about passing fileobj to os.read. Indeed, the
parameter should be an int, but I guess fileobj gets automatically
converted. In any case, using the fd is better.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/py/unittests.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kieran Bingham May 17, 2022, 4:23 p.m. UTC | #1
Quoting Tomi Valkeinen (2022-05-17 15:33:16)
> pyright complains about passing fileobj to os.read. Indeed, the
> parameter should be an int, but I guess fileobj gets automatically
> converted. In any case, using the fd is better.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  test/py/unittests.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/test/py/unittests.py b/test/py/unittests.py
> index cbc00ff3..9326358d 100755
> --- a/test/py/unittests.py
> +++ b/test/py/unittests.py
> @@ -262,8 +262,8 @@ class SimpleCaptureMethods(CameraTesterBase):
>          running = True
>          while running:
>              events = sel.select()
> -            for key, mask in events:
> -                os.read(key.fileobj, 8)
> +            for key, _ in events:
> +                os.read(key.fd, 8)
>  
>                  ready_reqs = cm.get_ready_requests()
>  
> -- 
> 2.34.1
>

Patch
diff mbox series

diff --git a/test/py/unittests.py b/test/py/unittests.py
index cbc00ff3..9326358d 100755
--- a/test/py/unittests.py
+++ b/test/py/unittests.py
@@ -262,8 +262,8 @@  class SimpleCaptureMethods(CameraTesterBase):
         running = True
         while running:
             events = sel.select()
-            for key, mask in events:
-                os.read(key.fileobj, 8)
+            for key, _ in events:
+                os.read(key.fd, 8)
 
                 ready_reqs = cm.get_ready_requests()