Skip to content

Commit 7e284ad

Browse files
Fix evaluation crashing when group leader is from another node (#27)
1 parent bad1d56 commit 7e284ad

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
include:
1515
- pair: { elixir: "1.15.8", otp: "25.3" }
1616
python_minor: "10"
17-
- pair: { elixir: "1.18.1", otp: "27.2" }
17+
- pair: { elixir: "1.18.4", otp: "27.2" }
1818
python_minor: "10"
19-
- pair: { elixir: "1.18.1", otp: "27.2" }
19+
- pair: { elixir: "1.18.4", otp: "27.2" }
2020
python_minor: "11"
21-
- pair: { elixir: "1.18.1", otp: "27.2" }
21+
- pair: { elixir: "1.18.4", otp: "27.2" }
2222
python_minor: "12"
23-
- pair: { elixir: "1.18.1", otp: "27.2" }
23+
- pair: { elixir: "1.18.4", otp: "27.2" }
2424
python_minor: "13"
2525
lint: true
2626
env:
@@ -59,7 +59,7 @@ jobs:
5959
include:
6060
- pair: { elixir: "1.15.8", otp: "25.3" }
6161
python_minor: "10"
62-
- pair: { elixir: "1.18.1", otp: "27.2" }
62+
- pair: { elixir: "1.18.4", otp: "27.2" }
6363
python_minor: "13"
6464
env:
6565
MIX_ENV: test
@@ -92,7 +92,7 @@ jobs:
9292
include:
9393
- pair: { elixir: "1.15.8", otp: "25.3" }
9494
python_minor: "10"
95-
- pair: { elixir: "1.18.1", otp: "27.2" }
95+
- pair: { elixir: "1.18.4", otp: "27.2" }
9696
python_minor: "13"
9797
env:
9898
MIX_ENV: test

c_src/pythonx.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ struct ExObject {
190190
static constexpr auto module = &atoms::ElixirPythonxObject;
191191

192192
static constexpr auto fields() {
193-
return std::make_tuple(std::make_tuple(&ExObject::resource, &atoms::resource));
193+
return std::make_tuple(
194+
std::make_tuple(&ExObject::resource, &atoms::resource));
194195
}
195196
};
196197

@@ -216,8 +217,8 @@ struct ExError {
216217
};
217218

218219
struct EvalInfo {
219-
ErlNifPid stdout_device;
220-
ErlNifPid stderr_device;
220+
fine::Term stdout_device;
221+
fine::Term stderr_device;
221222
ErlNifEnv *env;
222223
std::thread::id thread_id;
223224
};
@@ -1140,7 +1141,7 @@ std::tuple<PyObjectPtr, PyObjectPtr> compile(ErlNifEnv *env,
11401141
std::tuple<std::optional<ExObject>, fine::Term>
11411142
eval(ErlNifEnv *env, ErlNifBinary code, std::string code_md5,
11421143
std::vector<std::tuple<ErlNifBinary, ExObject>> globals,
1143-
ErlNifPid stdout_device, ErlNifPid stderr_device) {
1144+
fine::Term stdout_device, fine::Term stderr_device) {
11441145
ensure_initialized();
11451146

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

13891390
// Note that we send the output to Pythonx.Janitor and it then sends
13901391
// it to the device. We do this to avoid IO replies being sent to
1391-
// the calling Elixir process (which would be unexpected).
1392+
// the calling Elixir process (which would be unexpected). Additionally,
1393+
// we cannot send to remote PIDs from a NIF, while the Janitor can.
13921394
auto janitor_name = fine::encode(env, pythonx::atoms::ElixirPythonxJanitor);
13931395
ErlNifPid janitor_pid;
13941396
if (enif_whereis_pid(caller_env, janitor_name, &janitor_pid)) {

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ defmodule Pythonx.MixProject do
3939

4040
defp deps do
4141
[
42-
{:fine, "~> 0.1.0", runtime: false},
42+
{:fine, "~> 0.1.2", runtime: false},
4343
{:elixir_make, "~> 0.9", runtime: false},
4444
{:cc_precompiler, "~> 0.1", runtime: false},
4545
{:ex_doc, "~> 0.36", only: :dev, runtime: false}

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"earmark_parser": {:hex, :earmark_parser, "1.4.42", "f23d856f41919f17cd06a493923a722d87a2d684f143a1e663c04a2b93100682", [:mix], [], "hexpm", "6915b6ca369b5f7346636a2f41c6a6d78b5af419d61a611079189233358b8b8b"},
44
"elixir_make": {:hex, :elixir_make, "0.9.0", "6484b3cd8c0cee58f09f05ecaf1a140a8c97670671a6a0e7ab4dc326c3109726", [:mix], [], "hexpm", "db23d4fd8b757462ad02f8aa73431a426fe6671c80b200d9710caf3d1dd0ffdb"},
55
"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"},
6-
"fine": {:hex, :fine, "0.1.0", "9bb99a5ff9b968f12c3b458fa1277c39e9a620b23a9439103703a25917293871", [:mix], [], "hexpm", "1d6485bf811b95dc6ae3d197c0e6f994880b86167a827983bb29cbfc03a02684"},
6+
"fine": {:hex, :fine, "0.1.2", "85cf7dd190c7c6c54c2840754ae977c9acc0417316255b674fad9f2678e4ecc7", [:mix], [], "hexpm", "9113531982c2b60dbea6c7233917ddf16806947cd7104b5d03011bf436ca3072"},
77
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
88
"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"},
99
"makeup_erlang": {:hex, :makeup_erlang, "1.0.1", "c7f58c120b2b5aa5fd80d540a89fdf866ed42f1f3994e4fe189abebeab610839", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "8a89a1eeccc2d798d6ea15496a6e4870b75e014d1af514b1b71fa33134f57814"},

0 commit comments

Comments
 (0)