bt2: require msg for _OverflowError in _handle_func_status
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 8 Nov 2023 16:21:54 +0000 (16:21 +0000)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 23 Jan 2024 18:44:05 +0000 (13:44 -0500)
Pyright says:

    /home/smarchi/src/babeltrace/src/bindings/python/bt2/bt2/utils.py:160:19 - error: Invalid exception class or object
    Constructor for exception type "type[_OverflowError]" requires one or more arguments (reportGeneralTypeIssues)

That's true, _OverflowError has bt2_error._Error as a base, which
requires a message.  Change _handle_func_status to assert that a msg was
provided when handling that case.

Change-Id: I961c336cf53ce13e5f4241728e1131cccb77efcf
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11297
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/bindings/python/bt2/bt2/utils.py

index c8fb517152d2107a64bd90ae3a9125a1293ab8c8..fc6d24ce79d8b9c4915238b87ed3f7205c97b63f 100644 (file)
@@ -156,10 +156,7 @@ def _handle_func_status(status, msg=None):
         else:
             raise TryAgain(msg)
     elif status == native_bt.__BT_FUNC_STATUS_OVERFLOW_ERROR:
-        if msg is None:
-            raise _OverflowError
-        else:
-            raise _OverflowError(msg)
+        raise _OverflowError(msg)
     elif status == native_bt.__BT_FUNC_STATUS_UNKNOWN_OBJECT:
         if msg is None:
             raise UnknownObject
This page took 0.025397 seconds and 4 git commands to generate.