Skip to content
Merged
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
Up
  • Loading branch information
jonatanklosko committed Feb 27, 2025
commit 036345cdd2a6d2e06cf416b194f941b4a11f9253
4 changes: 2 additions & 2 deletions lib/pythonx.ex
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ defmodule Pythonx do
defmacro sigil_PY({:<<>>, _meta, [code]}, []) when is_binary(code) do
%{referenced: referenced, defined: defined} = Pythonx.AST.scan_globals(code)

versioned_vars = __CALLER__.versioned_vars
caller = __CALLER__

globals_entries =
for name <- referenced,
Expand All @@ -290,7 +290,7 @@ defmodule Pythonx do
# 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
Macro.Env.has_var?(caller, {name_atom, nil}) do
{name, {name_atom, [], nil}}
end

Expand Down