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
Prev Previous commit
Next Next commit
Format
  • Loading branch information
jonatanklosko committed Feb 26, 2025
commit 4870be26bb538e09670a67fff20604eff6ac3998
12 changes: 6 additions & 6 deletions lib/pythonx.ex
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,12 @@ defmodule Pythonx do

globals_entries =
for name <- referenced,
name_atom = String.to_atom(name),
# We only reference variables that are actually defined. This
# way, if an undefined variable is referenced in the Python
# code, it results in an informative Python error, rather than
# Elixir compile error.
Map.has_key?(versioned_vars, {name_atom, nil}) do
name_atom = String.to_atom(name),
# We only reference variables that are actually defined.
# This way, if an undefined variable is referenced in the
# Python code, it results in an informative Python error,
# rather than Elixir compile error.
Map.has_key?(versioned_vars, {name_atom, nil}) do
{name, {name_atom, [], nil}}
end

Expand Down
4 changes: 1 addition & 3 deletions test/pythonx_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,7 @@ defmodule PythonxTest do
''',
[]
)

end

end
end

test "global redefinition" do
Expand Down