You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Long arguments in a function cause a fatal error for pylint. I am not sure whether this is a bug for pylint, CPython also reports a MemoryError, but not a fatal error.
>> pylint pylint_example.py
************* Module pylint_example
Desktop/pylint_example.py:14:3: C0303: Trailing whitespace (trailing-whitespace)
Desktop/pylint_example.py:17:13: C0303: Trailing whitespace (trailing-whitespace)
Desktop/pylint_example.py:18:0: W0311: Bad indentation. Found 1 spaces, expected 4 (bad-indentation)
Desktop/pylint_example.py:61:0: C0305: Trailing newlines (trailing-newlines)
Desktop/pylint_example.py:1:0: C0114: Missing module docstring (missing-module-docstring)
Desktop/pylint_example.py:17:0: C0116: Missing function or method docstring (missing-function-docstring)
Desktop/pylint_example.py:17:0: C0103: Function name "f" doesn't conform to snake_case naming style (invalid-name)
Exception on node <Call l.19 at 0x7f8b272a9e90> in file '/home/xxm/Desktop/pylint_example.py'
Traceback (most recent call last):
File "/home/xxm/.local/lib/python3.11/site-packages/pylint/utils/ast_walker.py", line 91, in walk
callback(astroid)
File "/home/xxm/.local/lib/python3.11/site-packages/pylint/checkers/method_args.py", line 73, in visit_call
self._check_missing_timeout(node)
File "/home/xxm/.local/lib/python3.11/site-packages/pylint/checkers/method_args.py", line 83, in _check_missing_timeout
call_site = arguments.CallSite.from_call(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/arguments.py", line 67, in from_call
return cls(callcontext, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/arguments.py", line 45, in __init__
self._unpacked_args = self._unpack_args(args, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/arguments.py", line 126, in _unpack_args
inferred = safe_infer(arg.value, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/helpers.py", line 171, in safe_infer
value = next(inferit)
^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/nodes/node_ng.py", line 179, in infer
for i, result in enumerate(self._infer(context=context, **kwargs)):
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/decorators.py", line 71, in inner
yield next(generator)
^^^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/decorators.py", line 49, in wrapped
for res in _func(node, context, **kwargs):
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/inference.py", line 567, in _filter_operation_errors
for result in infer_callable(self, context):
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/inference.py", line 987, in _infer_binop
yield from _infer_binary_operation(lhs, rhs, self, context, _get_binop_flow)
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/inference.py", line 936, in _infer_binary_operation
results = list(method())
^^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/decorators.py", line 71, in inner
yield next(generator)
^^^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/protocols.py", line 224, in tl_infer_binary_op
yield _multiply_seq_by_int(self, opnode, other, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxm/.local/lib/python3.11/site-packages/astroid/protocols.py", line 175, in _multiply_seq_by_int
node.elts = list(filtered_elts) * other.value
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
MemoryError
Desktop/pylint_example.py:1:0: F0002: /home/xxm/Desktop/pylint_example.py: Fatal error while checking '/home/xxm/Desktop/pylint_example.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/xxm/.cache/pylint/pylint-crash-2023-06-07-13-30-48.txt'. (astroid-error)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
Thanks for the report. safe_infer could catch MemoryError, or we could add some sort of clever guard like #6745, but I would be weary of accumulating too many clever guards all over.
Long arguments in a function cause a fatal error for pylint. I am not sure whether this is a bug for pylint, CPython also reports a MemoryError, but not a fatal error.
pylint_example.py
The expected behavior:
There should be no fatal errors.
The actual output
Test Environment
pylint 3.0.0b1
astroid 3.0.0a5-dev0
Python 3.11.3
Ubuntu 18.04
The text was updated successfully, but these errors were encountered: