Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix evaluation crashing when group leader is from another node
  • Loading branch information
jonatanklosko committed Jul 29, 2025
commit ea408669fbd25717cdd97aeaded79e4b47d12e39
12 changes: 7 additions & 5 deletions c_src/pythonx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ struct ExObject {
static constexpr auto module = &atoms::ElixirPythonxObject;

static constexpr auto fields() {
return std::make_tuple(std::make_tuple(&ExObject::resource, &atoms::resource));
return std::make_tuple(
std::make_tuple(&ExObject::resource, &atoms::resource));
}
};

Expand All @@ -216,8 +217,8 @@ struct ExError {
};

struct EvalInfo {
ErlNifPid stdout_device;
ErlNifPid stderr_device;
fine::Term stdout_device;
fine::Term stderr_device;
ErlNifEnv *env;
std::thread::id thread_id;
};
Expand Down Expand Up @@ -1140,7 +1141,7 @@ std::tuple<PyObjectPtr, PyObjectPtr> compile(ErlNifEnv *env,
std::tuple<std::optional<ExObject>, fine::Term>
eval(ErlNifEnv *env, ErlNifBinary code, std::string code_md5,
std::vector<std::tuple<ErlNifBinary, ExObject>> globals,
ErlNifPid stdout_device, ErlNifPid stderr_device) {
fine::Term stdout_device, fine::Term stderr_device) {
ensure_initialized();

// Step 1: compile (or get cached result)
Expand Down Expand Up @@ -1388,7 +1389,8 @@ extern "C" void pythonx_handle_io_write(const char *message,

// Note that we send the output to Pythonx.Janitor and it then sends
// it to the device. We do this to avoid IO replies being sent to
// the calling Elixir process (which would be unexpected).
// the calling Elixir process (which would be unexpected). Additionally,
// we cannot send to remote PIDs from a NIF, while the Janitor can.
auto janitor_name = fine::encode(env, pythonx::atoms::ElixirPythonxJanitor);
ErlNifPid janitor_pid;
if (enif_whereis_pid(caller_env, janitor_name, &janitor_pid)) {
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule Pythonx.MixProject do

defp deps do
[
{:fine, "~> 0.1.0", runtime: false},
{:fine, "~> 0.1.2", runtime: false},
{:elixir_make, "~> 0.9", runtime: false},
{:cc_precompiler, "~> 0.1", runtime: false},
{:ex_doc, "~> 0.36", only: :dev, runtime: false}
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"earmark_parser": {:hex, :earmark_parser, "1.4.42", "f23d856f41919f17cd06a493923a722d87a2d684f143a1e663c04a2b93100682", [:mix], [], "hexpm", "6915b6ca369b5f7346636a2f41c6a6d78b5af419d61a611079189233358b8b8b"},
"elixir_make": {:hex, :elixir_make, "0.9.0", "6484b3cd8c0cee58f09f05ecaf1a140a8c97670671a6a0e7ab4dc326c3109726", [:mix], [], "hexpm", "db23d4fd8b757462ad02f8aa73431a426fe6671c80b200d9710caf3d1dd0ffdb"},
"ex_doc": {:hex, :ex_doc, "0.36.1", "4197d034f93e0b89ec79fac56e226107824adcce8d2dd0a26f5ed3a95efc36b1", [:mix], [{:earmark_parser, "~> 1.4.42", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "d7d26a7cf965dacadcd48f9fa7b5953d7d0cfa3b44fa7a65514427da44eafd89"},
"fine": {:hex, :fine, "0.1.0", "9bb99a5ff9b968f12c3b458fa1277c39e9a620b23a9439103703a25917293871", [:mix], [], "hexpm", "1d6485bf811b95dc6ae3d197c0e6f994880b86167a827983bb29cbfc03a02684"},
"fine": {:hex, :fine, "0.1.2", "85cf7dd190c7c6c54c2840754ae977c9acc0417316255b674fad9f2678e4ecc7", [:mix], [], "hexpm", "9113531982c2b60dbea6c7233917ddf16806947cd7104b5d03011bf436ca3072"},
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
"makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"},
"makeup_erlang": {:hex, :makeup_erlang, "1.0.1", "c7f58c120b2b5aa5fd80d540a89fdf866ed42f1f3994e4fe189abebeab610839", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "8a89a1eeccc2d798d6ea15496a6e4870b75e014d1af514b1b71fa33134f57814"},
Expand Down
Loading