Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jupyter): await Jupyter.display evaluation #20646

Merged
merged 1 commit into from
Sep 23, 2023

Conversation

bartlomieju
Copy link
Member

I believe this fixes #20528.

There are a few things happening here:

  1. primitive values are not going through formatting for Jupyter MIME bunndle
  2. evaluation of object[Symbol.for("Jupyter.display")] is wrapped in a try/catch block
  3. evaluation of object[Symbol.for("Jupyter.display")] is awaited

I was unable to reproduce the "Promise was collected" error with this change.

Copy link
Contributor

@mmastrac mmastrac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix. Lgtm

@@ -599,8 +609,12 @@ async fn get_jupyter_display_or_eval_value(
return Ok(HashMap::default());
}

if let Some(data) = get_jupyter_display(session, evaluate_result).await? {
return Ok(data);
// If the response is a primitive value we don't need to try and format
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bartlomieju bartlomieju merged commit b1ca67a into denoland:main Sep 23, 2023
13 checks passed
@bartlomieju bartlomieju deleted the jupyter_promise_collected branch September 23, 2023 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[repl][jupyter-kernel] {"code":-32000,"message":"Promise was collected"}
3 participants