From 128922ac65784191fee6ff7a2c8ecc1966d41913 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 5 Aug 2022 20:14:14 +0200 Subject: [PATCH] Remove error status for Python in favor of native Python errors --- binaries/runtime/src/operator/python.rs | 5 ++--- examples/python-operator/op.py | 1 - examples/python-operator/op2.py | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/binaries/runtime/src/operator/python.rs b/binaries/runtime/src/operator/python.rs index 0cd56a92..8a492256 100644 --- a/binaries/runtime/src/operator/python.rs +++ b/binaries/runtime/src/operator/python.rs @@ -79,9 +79,8 @@ pub fn spawn( let status: i32 = Python::with_gil(|py| status_val.extract(py)) .wrap_err("on_input has invalid return value")?; match status { - 0 => {} // ok - 1 => break, // stop - -1 => bail!("on_input returned an error"), // err + 0 => {} // ok + 1 => break, // stop other => bail!("on_input returned invalid status {other}"), } } diff --git a/examples/python-operator/op.py b/examples/python-operator/op.py index 749283fc..bffe8508 100644 --- a/examples/python-operator/op.py +++ b/examples/python-operator/op.py @@ -3,7 +3,6 @@ from enum import Enum class DoraStatus(Enum): CONTINUE = 0 - ERR = -1 STOP = 1 class Operator: diff --git a/examples/python-operator/op2.py b/examples/python-operator/op2.py index 4ce287ac..0053b1a4 100644 --- a/examples/python-operator/op2.py +++ b/examples/python-operator/op2.py @@ -3,7 +3,6 @@ from enum import Enum class DoraStatus(Enum): OK = 0 - ERR = -1 STOP = 1 class Operator: