Skip to content

Commit

Permalink
Add :generated to ~PY assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko committed Feb 23, 2025
1 parent a89aa68 commit 15af1c8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/pythonx.ex
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ defmodule Pythonx do
assignments =
for name <- defined do
quote do
unquote({String.to_atom(name), [], nil}) = Map.get(globals, unquote(name), nil)
# We do an extra underscore assignment to make sure the
# generated code does not trigger an unused variable warning.
_ = unquote({String.to_atom(name), [], nil})
# We include :generated to avoid unused variable warnings,
# if the variables are not referenced later on.
unquote({String.to_atom(name), [generated: true], nil}) =
Map.get(globals, unquote(name), nil)
end
end

Expand Down

0 comments on commit 15af1c8

Please sign in to comment.