Skip to content

pylint endless recursion with short example using setuptools.build_meta import #5408

@kayhayen

Description

@kayhayen

Bug description

""" Nuitka python -m build integration """

# This lines triggers the bug
from setuptools.build_meta import anything

The bug must be coming due to the module imported, if I change the name, no crash.

Command used

['/usr/bin/python3', 
'-m', 
'pylint', 
'--init-hook=import sys;sys.setrecursionlimit(1024*sys.getrecursionlimit())', 
'--disable=I0011,I0012,no-init,bad-whitespace,bad-continuation,E1103,W0632,W1504,C0123,C0411,C0413,R0204,similar-code,cyclic-import,duplicate-code,deprecated-module,deprecated-method,deprecated-argument,assignment-from-none,ungrouped-imports,no-else-return,c-extension-no-member,inconsistent-return-statements,raise-missing-from,import-outside-toplevel,useless-object-inheritance,useless-return,assignment-from-no-return,redundant-u-string-prefix,consider-using-f-string', 
'--enable=useless-suppression', 
'--msg-template="{path}:{line} {msg_id} {symbol} {obj} {msg}"', 
'--reports=no', 
'--persistent=no', 
'--method-rgx=[a-z_][a-zA-Z0-9_]{2,40}$', 
'--module-rgx=.*', 
'--function-rgx=.*', 
'--variable-rgx=.*', 
'--argument-rgx=.*', 
'--dummy-variables-rgx=_.*|trace_collection', 
'--ignored-argument-names=_.*|trace_collection', 
'--const-rgx=.*', 
'--max-line-length=125', 
'--no-docstring-rgx=.*', 
'--max-module-lines=5000', 
'--min-public-methods=0', 
'--max-public-methods=100', 
'--max-args=11', 
'--max-parents=13', 
'--max-statements=50', 
'--max-nested-blocks=10', 
'--max-bool-expr=10', 
'--score=no', 
'--rcfile=/dev/null', 
'--notes=', 
'nuitka/distutils/Build.py']

See above, I am using the init hook, because I have hit recursion limits in the past and there expanding them was helpful. With my command though it was a segfault, so it's clearly going endless.

Pylint output

Error, segfault from pylint. It sees if I remove my recursion limit init hook, I am getting this as an infinite trace:

    yield next(generator)
  File "/home/hayen/.local/lib/python3.7/site-packages/astroid/decorators.py", line 111, in wrapped
    for res in _func(node, context, **kwargs):
  File "/home/hayen/.local/lib/python3.7/site-packages/astroid/bases.py", line 156, in _infer_stmts
    for inf in stmt.infer(context=context):
  File "/home/hayen/.local/lib/python3.7/site-packages/astroid/nodes/node_ng.py", line 170, in infer
    for i, result in enumerate(generator):
  File "/home/hayen/.local/lib/python3.7/site-packages/astroid/decorators.py", line 142, in raise_if_nothing_inferred

Expected behavior

Do not crash.

Pylint version

pylint==2.12.1
astroid==2.9.0
setuptools 45.3.0 from /usr/local/lib/python3.7/dist-packages (Python 3.7)

OS / Environment

Debian Buster, Github Actions too, I don't think OS related

Additional dependencies

setuptools 45.3.0 code is what actually triggers it apparently

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🪲Crash 💥A bug that makes pylint crashNeeds astroid updateNeeds an astroid update (probably a release too) before being mergable

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions