Commit 917296b4 authored by Arnaud Fontaine's avatar Arnaud Fontaine

pylint 1.4: Understands six.{PY2,PY3} import guards (already supported on pylint 2).

parent 66c1fc8c
......@@ -14,6 +14,7 @@ recipe = zc.recipe.egg:custom
patches =
${:_profile_base_location_}/pylint-super_on_old_class.patch#cb0c3f8c091bf4980be395c917edc435
${:_profile_base_location_}/pylint-redefining-builtins-modules.patch#043defc6e9002ac48b40e078797d4d17
${:_profile_base_location_}/understands-six.PY2-six.PY3-import-guard.patch#39f8ef6c16648dc41685a94399fd2cdb
patch-options = -p1
patch-binary = ${patch:location}/bin/patch
......
Author: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Wed Apr 3 14:58:52 2024 +0900
Fixes #3501 (pylint.git:e5e6ca71) for pylint 1.4.
--- a/pylint/checkers/variables.py 2024-06-26 16:40:48.654379000 +0000
+++ b/pylint/checkers/variables.py 2024-09-25 10:31:09.680816539 +0000
@@ -987,7 +987,10 @@
if module is astroid.YES:
return None
except astroid.NotFoundError:
- if module.name in ignored_modules:
+ if (module.name in ignored_modules or
+ (node.parent is not None and
+ isinstance(node.parent, astroid.nodes.If) and
+ node.parent.test.as_string() in ('six.PY2', 'six.PY3'))):
return None
self.add_message('no-name-in-module',
args=(name, module.name), node=node)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment