pylint icon indicating copy to clipboard operation
pylint copied to clipboard

Crash while linting Copr code on Fedora 37

Open praiskup opened this issue 3 years ago • 2 comments

Bug description

pylint crashed with a AstroidError and with the following stacktrace:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 727, in _check_file
    check_astroid_module(ast_node)
  File "/usr/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 926, in check_astroid_module
    retval = self._check_astroid_module(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 976, in _check_astroid_module
    walker.walk(node)
  File "/usr/lib/python3.11/site-packages/pylint/utils/ast_walker.py", line 93, in walk
    self.walk(child)
  File "/usr/lib/python3.11/site-packages/pylint/utils/ast_walker.py", line 93, in walk
    self.walk(child)
  File "/usr/lib/python3.11/site-packages/pylint/utils/ast_walker.py", line 93, in walk
    self.walk(child)
  [Previous line repeated 1 more time] 
  File "/usr/lib/python3.11/site-packages/pylint/utils/ast_walker.py", line 90, in walk
    callback(astroid)
  File "/usr/lib/python3.11/site-packages/pylint/checkers/typecheck.py", line 1114, in visit_attribute
    attr_parent = attr_node.parent
                  ^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'parent'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 684, in _check_files
    self._check_file(get_ast, check_astroid_module, file) 
  File "/usr/lib/python3.11/site-packages/pylint/lint/pylinter.py", line 729, in _check_file
    raise astroid.AstroidError from e
astroid.exceptions.AstroidError

Command used

pylint coprs_frontend/coprs/__init__.py coprs_frontend/coprs/logic/builds_logic.py coprs_frontend/coprs/views/apiv3_ns/apiv3_builds.py coprs_frontend/coprs/views/coprs_ns/coprs_builds.py

Pylint output

Exception on node <Attribute.exception l.938 at 0x7f43e7a5bb90> in file '/home/praiskup/rh/projects/copr/copr/frontend/coprs_frontend/coprs/logic/builds_logic.py'
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pylint/utils/ast_walker.py", line 90, in walk
    callback(astroid)
  File "/usr/lib/python3.11/site-packages/pylint/checkers/typecheck.py", line 1114, in visit_attribute
    attr_parent = attr_node.parent
                  ^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'parent'
coprs_frontend/coprs/logic/builds_logic.py:1:0: F0002: coprs_frontend/coprs/logic/builds_logic.py: Fatal error while checking 'coprs_frontend/coprs/logic/builds_logic.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '/home/praiskup/.cache/pylint/pylint-crash-2022-10-12-15.txt'. (astroid-error)

Expected behavior

Should not traceback.

Pylint version

pylint-2.14.4-3.fc37.noarch
python3-astroid-2.12.10-1.fc37.noarch
python3-3.11.0~rc2-1.fc37.x86_64

OS / Environment

Fedora 37

praiskup avatar Oct 12 '22 13:10 praiskup

Steps:

  • git clone https://pagure.io/copr/copr.git
  • cd copr/frontend
  • pylint coprs_frontend/coprs/init.py coprs_frontend/coprs/logic/builds_logic.py coprs_frontend/coprs/views/apiv3_ns/apiv3_builds.py coprs_frontend/coprs/views/coprs_ns/coprs_builds.py

praiskup avatar Oct 12 '22 13:10 praiskup

This could also be caused with by the copr pylint plugin. I know we have had issues with that before.

Could you try disabling that plugin in the pylintrc and see if the crash still occurs?

DanielNoord avatar Oct 12 '22 18:10 DanielNoord

This issue is stale because it has been open 4 weeks with no activity. Remove 'Stale' label or comment or this will be closed in a week.

github-actions[bot] avatar Jul 13 '24 02:07 github-actions[bot]

This issue was closed because it has been stalled for five weeks with no activity.

github-actions[bot] avatar Jul 21 '24 02:07 github-actions[bot]