Skip to content

Commit 774d91b

Browse files
author
Nils Berg
committed
fall back to astroid.nodes.Module.locals if _locals is not available
1 parent 8c45570 commit 774d91b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pylint_django/transforms/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ def set_fake_locals(module):
2626
if module.name != package_name:
2727
return
2828
for class_name in class_names:
29-
module._locals[class_name] = fake._locals[class_name] # pylint: disable=protected-access
29+
# This changed from locals to _locals between astroid 1.3 and 1.4
30+
if hasattr(module, '_locals'):
31+
module._locals[class_name] = fake._locals[class_name] # pylint: disable=protected-access
32+
else:
33+
module.locals[class_name] = fake.locals[class_name]
3034

3135
MANAGER.register_transform(nodes.Module, set_fake_locals)
3236

0 commit comments

Comments
 (0)