Bug 1648299

Summary: pylint's is_subclass_of fails with AttributeError: 'NoneType' object has no attribute 'name'
Product: [Fedora] Fedora Reporter: Christian Heimes <cheimes>
Component: pylintAssignee: Christian Dersch <lupinix.fedora>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: lupinix.fedora, orion
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pylint-2.1.1-2.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-18 03:55:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Christian Heimes 2018-11-09 11:00:31 UTC
Description of problem:
Fedora 29's pylint is unable to analyse FreeIPA. It fails with an internal error . It's a known bug and has been addressed in upstream PR https://github.com/PyCQA/pylint/pull/2429 .

Version-Release number of selected component (if applicable):
python3-pylint-2.1.1-1.fc29.noarch

How reproducible:
always

Steps to Reproduce:
1. git clone https://pagure.io/freeipa.git
2. follow BUILD.txt to install dependencies
3. PYTHONPATH=. /usr/bin/python3 -m pylint --rcfile=./pylintrc --load-plugins pylint_plugins ipalib/rpc.py

Actual results:
$ PYTHONPATH=. /usr/bin/python3 -m pylint --rcfile=./pylintrc --load-plugins pylint_plugins ipalib/rpc.py 
Traceback (most recent call last):
  File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.7/site-packages/pylint/__main__.py", line 7, in <module>
    pylint.run_pylint()
  File "/usr/lib/python3.7/site-packages/pylint/__init__.py", line 19, in run_pylint
    Run(sys.argv[1:])
  File "/usr/lib/python3.7/site-packages/pylint/lint.py", line 1394, in __init__
    linter.check(args)
  File "/usr/lib/python3.7/site-packages/pylint/lint.py", line 801, in check
    self._do_check(files_or_modules)
  File "/usr/lib/python3.7/site-packages/pylint/lint.py", line 938, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File "/usr/lib/python3.7/site-packages/pylint/lint.py", line 1018, in check_astroid_module
    walker.walk(ast_node)
  File "/usr/lib/python3.7/site-packages/pylint/utils.py", line 1162, in walk
    self.walk(child)
  File "/usr/lib/python3.7/site-packages/pylint/utils.py", line 1162, in walk
    self.walk(child)
  File "/usr/lib/python3.7/site-packages/pylint/utils.py", line 1162, in walk
    self.walk(child)
  [Previous line repeated 2 more times]
  File "/usr/lib/python3.7/site-packages/pylint/utils.py", line 1159, in walk
    cb(astroid)
  File "/usr/lib/python3.7/site-packages/pylint/checkers/exceptions.py", line 394, in visit_tryexcept
    self._check_try_except_raise(node)
  File "/usr/lib/python3.7/site-packages/pylint/checkers/exceptions.py", line 373, in _check_try_except_raise
    utils.safe_infer(handler.type))):
  File "/usr/lib/python3.7/site-packages/pylint/checkers/utils.py", line 1011, in is_subclass_of
    return node_b.name in {base.name for base in node_a.bases}
AttributeError: 'NoneType' object has no attribute 'name'


Expected results:
No error

Additional info:
See https://github.com/PyCQA/pylint/pull/2429

Comment 1 Christian Heimes 2018-11-09 11:05:54 UTC
I have asked upstream to release a new version of pylint. Could you please backport the trivial fix to 2.1.1 in case upstream is unable to release 2.1.2 soon? The bug prevents FreeIPA from moving CI and development to Fedora 29.

Comment 2 Christian Dersch 2018-11-09 18:04:01 UTC
Backported the fix

Comment 3 Fedora Update System 2018-11-09 18:07:05 UTC
pylint-2.1.1-2.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-e9cbe13141

Comment 4 Fedora Update System 2018-11-10 05:01:26 UTC
pylint-2.1.1-2.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-e9cbe13141

Comment 5 Christian Heimes 2018-11-12 09:16:52 UTC
pylint-2.1.1-2 fixes the issue. FreeIPA's make pylint target passes successfully. Thanks!

Comment 6 Fedora Update System 2018-11-18 03:55:54 UTC
pylint-2.1.1-2.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.