-
Notifications
You must be signed in to change notification settings - Fork 443
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
Changes for Elixir 1.15 #1918
Changes for Elixir 1.15 #1918
Conversation
Uffizzi Preview |
try do | ||
quoted = Code.string_to_quoted!(code, file: env.file) | ||
|
||
try do | ||
{value, binding, env} = | ||
Code.eval_quoted_with_env(quoted, binding, env, prune_binding: true) | ||
|
||
{:ok, value, binding, env} | ||
catch | ||
kind, error -> | ||
stacktrace = prune_stacktrace(__STACKTRACE__) | ||
{:error, kind, error, stacktrace} | ||
end | ||
catch | ||
kind, error -> | ||
{:error, kind, error, []} | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so that for parsing errors we always return an empty stacktrace.
defp ensure_order(map) do | ||
map | ||
|> Enum.sort() | ||
|> Enum.map(fn | ||
{key, %{} = value} -> {key, ensure_order(value)} | ||
pair -> pair | ||
end) | ||
|> Jason.OrderedObject.new() | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Serialized maps used to have sorted keys, now we sort explicitly, so it's easier to test the exported source.
defp io_proxy?(pid) do | ||
try do | ||
info = Process.info(pid, [:dictionary]) | ||
info[:dictionary][:"$initial_call"] == {Livebook.Runtime.Evaluator.IOProxy, :init, 1} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can use the Registry instead of this check... 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do in a separate PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful!
Closes #1713.
Requires elixir-lang/elixir#12585.