diff --git a/src/pdl/pdl_context.py b/src/pdl/pdl_context.py index 26909d109..1d1bac708 100644 --- a/src/pdl/pdl_context.py +++ b/src/pdl/pdl_context.py @@ -179,4 +179,4 @@ def add_done_callback( case IndependentContext(context=c): p.context = PdlApply(f, c) case _: - assert False + assert False, f"Unexpected context type {type(p)}: {p}" diff --git a/src/pdl/pdl_interpreter.py b/src/pdl/pdl_interpreter.py index 57f56f153..d890b5cdd 100644 --- a/src/pdl/pdl_interpreter.py +++ b/src/pdl/pdl_interpreter.py @@ -2146,16 +2146,18 @@ def process_call_code( case "ipython": try: result = call_ipython(code_s, scope) - background = PdlList( - [ - PdlDict( # type: ignore - { - "role": state.role, - "content": lazy_apply(str, result), - "pdl__defsite": block.pdl__id, - }, - ), - ], # type: ignore + background = SingletonContext( + PdlList( + [ + PdlDict( # type: ignore + { + "role": state.role, + "content": lazy_apply(str, result), + "pdl__defsite": block.pdl__id, + }, + ), + ], # type: ignore + ) ) except KeyboardInterrupt as exc: raise exc from exc