← All tasks
pythonpycqa/flake8 #1650Not a task: already works

RecursionError on Python 3.6+3.7 with flake8 5.0.3

envgap__pycqa__flake8-1650

01 / FAILURE SIGNATURE

As reported upstream

RecursionError: maximum recursion depth exceeded
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
318a86a4a12d28cdfc41030ead547332d3461f45
Manifest
setup.cfg
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

pycqa/flake8 #1650 · read the original issue
### how did you install flake8?



```console

$ pip install --upgrade --upgrade-strategy eager -r dev-requirements.txt



In dev-requirements.txt:



flake8>=3.8.0; python_version == '2.7'

flake8>=3.8.0,<3.9.0; python_version == '3.4'

flake8>=3.8.0; python_version >= '3.5' and python_version <= '3.9'

flake8>=4.0.0; python_version >= '3.10'

```





### unmodified output of `flake8 --bug-report`



```json

{

  "platform": {

    "python_implementation": "CPython",

    "python_version": "3.7.13",

    "system": "Darwin"

  },

  "plugins": [

    {

      "plugin": "mccabe",

      "version": "0.7.0"

    },

    {

      "plugin": "pycodestyle",

      "version": "2.9.0"

    },

    {

      "plugin": "pyflakes",

      "version": "2.5.0"

    }

  ],

  "version": "5.0.3"

}

```





### describe the problem



#### what I expected to happen



flake8 succeeds with no issues



#### sample code



The issue happens on only some of our projects, and only on Python 3.6 and 3.7. On all projects where it fails, it does not fail on Python 3.8 or higher.



I saw the issue first with flake8 5.0.0 and also with 5.0.3 (did not check versions in between).



It can be reproduced for example in the https://github.com/pywbem/nocaselist project with these commands on Linux or MacOS:



```console

git clone https://github.com/pywbem/nocaselist.git

cd nocaselist

mkvirtualenv -p python3.7 py37

make develop

make check  # invokes flake8 and reproduces the failure

```



flake8 command and output showing the failure:



```console

flake8 --statistics --config=.flake8 --filename='*' setup.py nocaselist/_version.py nocaselist/_nocaselist.py nocaselist/__init__.py tests/__init__.py tests/utils/import_installed.py tests/utils/__init__.py tests/utils/simplified_test_function.py tests/unittest/test_package.py tests/unittest/__init__.py tests/unittest/test_nocaselist.py   

Traceback (most recent call last):

  File "/opt/hostedtoolcache/Python/3.7.13/x64/bin/flake8", line 8, in <module>

    sys.exit(main())

  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/flake8/main/cli.py", line 22, in main

    app.run(argv)

  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/flake8/main/application.py", line 336, in run

    self._run(argv)

  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/flake8/main/application.py", line 325, in _run

    self.run_checks()

  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/flake8/main/application.py", line 229, in run_checks

    self.file_checker_manager.run()

  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/flake8/checker.py", line 250, in run

    self.run_parallel()

  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/flake8/checker.py", line 217, in run_parallel

    for ret in pool_map:

  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/multiprocessing/pool.py", line 354, in <genexpr>

    return (item for chunk in result for item in chunk)

  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/multiprocessing/pool.py", line 748, in next

    raise value

  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/multiprocessing/pool.py", line 431, in _handle_tasks

    put(task)

  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/multiprocessing/connection.py", line 206, in send

    self._send_bytes(_ForkingPickler.dumps(obj))

  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/multiprocessing/reduction.py", line 51, in dumps

    cls(buf, protocol).dump(obj)

  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/collections/__init__.py", line 432, in __getnewargs__

    return tuple(self)

RecursionError: maximum recursion depth exceeded

```



See also this GitHub Actions run on the same project: https://github.com/pywbem/nocaselist/runs/7646495550?check_suite_focus=true

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]