fix: number out of range panics (#506)

This commit is contained in:
stefan-gorules
2026-08-19 11:01:36 +02:00
committed by GitHub
parent c615013a2d
commit 13722740a1
14 changed files with 231 additions and 87 deletions
+3 -1
View File
@@ -58,8 +58,10 @@ impl PyZenDecision {
let result = tokio::future_into_py_with_locals(py, get_current_locals(py)?, async move {
let response = worker_pool()
.spawn_pinned(move || async move {
let context =
zen_engine::Variable::try_from_value(context).map_err(|e| anyhow!(e))?;
decision
.evaluate_with_opts(context.into(), options.into())
.evaluate_with_opts(context, options.into())
.await
.map(crate::convert::PortableResponse::build)
.map_err(|e| {
+6 -2
View File
@@ -203,8 +203,10 @@ impl PyZenEngine {
.map(|request| {
let engine = self.engine.clone();
worker_pool().spawn_pinned(move || async move {
let context = zen_engine::Variable::try_from_value(request.context)
.map_err(|e| Value::String(format!("invalid context: {e}")))?;
engine
.evaluate_with_opts(request.key, request.context.into(), options)
.evaluate_with_opts(request.key, context, options)
.await
.map(crate::convert::PortableResponse::build)
.map_err(|e| {
@@ -263,8 +265,10 @@ impl PyZenEngine {
let result = tokio::future_into_py_with_locals(py, get_current_locals(py)?, async move {
let response = worker_pool()
.spawn_pinned(move || async move {
let context =
zen_engine::Variable::try_from_value(context).map_err(|e| anyhow!(e))?;
engine
.evaluate_with_opts(key, context.into(), options.into())
.evaluate_with_opts(key, context, options.into())
.await
.map(crate::convert::PortableResponse::build)
.map_err(|e| {