returns icon indicating copy to clipboard operation
returns copied to clipboard

Pylint hangs when running on a module that has type annotations from returns

Open dmrz opened this issue 4 years ago • 8 comments

I've noticed pylint is hanging (vscode's python plugin started to consume 100% CPU) when trying to lint a module that has type annotations from returns library.

Consider the following test.py:

from returns.maybe import Maybe, Some

x: Maybe[int] = Some(1)

Running pylint test.py will hang forever.

Not sure if the problem is with returns or pylint itself (or maybe something with my local setup, tried both with my regular pylint config and without it though). Didn't spend much time debugging it, but sometimes I noticed it hangs in astroid.decorators.raise_if_nothing_inferred generator. Does anyone experience the same?

python: 3.7.9, 3.9.0
pylint: 2.6.0
astroid: 2.4.2
returns: 0.15.0

dmrz avatar Jan 21 '21 08:01 dmrz

Hi, @dmrz!

Hae you opened a bug in pylint? Can you please post a link here?

sobolevn avatar Jan 21 '21 09:01 sobolevn

I am not a pylint user, I can shamelessy plug: https://github.com/wemake-services/wemake-python-styleguide

sobolevn avatar Jan 21 '21 09:01 sobolevn

Hi, @dmrz!

Hae you opened a bug in pylint? Can you please post a link here?

Hi! I didn't, since I am not sure yet what is the source of the problem, just was wondering if anyone experienced the same before. Not a pylint fan, but there're projects I work on that use it. I will check that WPS, thanks!

dmrz avatar Jan 21 '21 09:01 dmrz

I am pretty sure that this is on pylint, bacause our annotations work with:

  • python
  • flake8
  • mypy
  • pyright
  • etc

And since we use it to the max, possibly there's a regression in pylint's infering logic.

sobolevn avatar Jan 21 '21 09:01 sobolevn

Hi! Got same issue with pylint and Result, Success, Failure. Found that by commenting everywhere import and code. After that pylint runs faster.

isratmir avatar Oct 31 '21 17:10 isratmir

Please, report this on pylints repo! And post an issue number here. 👍

I can help pylint's team, but there's nothing we can do from our side.

sobolevn avatar Oct 31 '21 18:10 sobolevn

Simply import returns.result hangs Pylint.

Edit: If left alone it does complete, after 1h 43m 30s

bcb avatar Oct 10 '22 01:10 bcb