Skip to content

Commit 15af1c8

Browse files
committed
Add :generated to ~PY assignments
1 parent a89aa68 commit 15af1c8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/pythonx.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,10 @@ defmodule Pythonx do
289289
assignments =
290290
for name <- defined do
291291
quote do
292-
unquote({String.to_atom(name), [], nil}) = Map.get(globals, unquote(name), nil)
293-
# We do an extra underscore assignment to make sure the
294-
# generated code does not trigger an unused variable warning.
295-
_ = unquote({String.to_atom(name), [], nil})
292+
# We include :generated to avoid unused variable warnings,
293+
# if the variables are not referenced later on.
294+
unquote({String.to_atom(name), [generated: true], nil}) =
295+
Map.get(globals, unquote(name), nil)
296296
end
297297
end
298298

0 commit comments

Comments
 (0)