Skip to content

Commit c46d3de

Browse files
authored
fix: bug in ipython code block (#1314)
Signed-off-by: Louis Mandel <[email protected]>
1 parent 9b244ac commit c46d3de

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/pdl/pdl_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,4 @@ def add_done_callback(
179179
case IndependentContext(context=c):
180180
p.context = PdlApply(f, c)
181181
case _:
182-
assert False
182+
assert False, f"Unexpected context type {type(p)}: {p}"

src/pdl/pdl_interpreter.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,16 +2146,18 @@ def process_call_code(
21462146
case "ipython":
21472147
try:
21482148
result = call_ipython(code_s, scope)
2149-
background = PdlList(
2150-
[
2151-
PdlDict( # type: ignore
2152-
{
2153-
"role": state.role,
2154-
"content": lazy_apply(str, result),
2155-
"pdl__defsite": block.pdl__id,
2156-
},
2157-
),
2158-
], # type: ignore
2149+
background = SingletonContext(
2150+
PdlList(
2151+
[
2152+
PdlDict( # type: ignore
2153+
{
2154+
"role": state.role,
2155+
"content": lazy_apply(str, result),
2156+
"pdl__defsite": block.pdl__id,
2157+
},
2158+
),
2159+
], # type: ignore
2160+
)
21592161
)
21602162
except KeyboardInterrupt as exc:
21612163
raise exc from exc

0 commit comments

Comments
 (0)