Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result of cyclic-import check [R0401] depends on execution speed #7137

Closed
jpieger opened this issue Jul 6, 2022 · 1 comment
Closed

Result of cyclic-import check [R0401] depends on execution speed #7137

jpieger opened this issue Jul 6, 2022 · 1 comment
Labels
Duplicate 🐫 Duplicate of an already existing issue multiprocessing

Comments

@jpieger
Copy link

jpieger commented Jul 6, 2022

Bug description

There seems to be a race condition in the cyclic-import checker. When pylint is executed with multiple jobs, then it can miss cyclic imports on fast machines.

File example/a.py:

# pylint: disable=unused-import,missing-module-docstring
import b

File example/b.py

# pylint: disable=unused-import,missing-module-docstring
import a

Configuration

[MAIN]

# With this configuration the issue is found
jobs=1

# With this configuration it is missed
# jobs=2

Command used

pylint example/

Pylint output

Running with jobs=1:

$ pylint example
************* Module a
example/a.py:1:0: R0401: Cyclic import (a -> b) (cyclic-import)
------------------------------------------------------------------
Your code has been rated at 5.00/10 (previous run: 5.00/10, +0.00)

Running with jobs=2:
$ pylint example

-------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 5.00/10, +5.00)

Expected behavior

Changing the number of jobs should not affect the result.

Pylint version

pylint 2.14.4
astroid 2.11.6
Python 3.9.13 (main, May 18 2022, 19:39:14) 
[GCC 12.1.0]

OS / Environment

Problem was observed on Arch Linux, Ubuntu 20.04 and Windows 10

Additional dependencies

No response

@jpieger jpieger added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jul 6, 2022
@jacobtylerwalls
Copy link
Member

Duplicate of #374

@jacobtylerwalls jacobtylerwalls marked this as a duplicate of #374 Jul 6, 2022
@jacobtylerwalls jacobtylerwalls added Duplicate 🐫 Duplicate of an already existing issue multiprocessing and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🐫 Duplicate of an already existing issue multiprocessing
Projects
None yet
Development

No branches or pull requests

2 participants