-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds investigation 🔬A bug or crash where it's not immediately obvious what is happenningA bug or crash where it's not immediately obvious what is happenningmultiprocessingnamespace-package
Description
Bug description
Files with content:
a/b.py -> B = 1
a/c/d.py -> from ..b import B
If I run one of:
pylint --jobs 0 --disable=all --enable=relative-beyond-top-level --source-roots . a/
pylint --jobs 1 --disable=all --enable=relative-beyond-top-level --source-roots . a/c/d.py
everything is well. But if I run:
pylint --jobs 0 --disable=all --enable=relative-beyond-top-level --source-roots . a/c/d.py
I get an error:
************* Module d
a/c/d.py:1:0: E0402: Attempted relative import beyond top-level package (relative-beyond-top-level)
(The only potentially related bug I could find is #10147, but I'm not sure whether it's really related.)
Configuration
Command used
mkdir -p a/c
echo "B = 1" > a/b.py
echo "from ..b import B" > a/c/d.py
# These ones are successful:
pylint --jobs 0 --disable=all --enable=relative-beyond-top-level --source-roots . a/
pylint --jobs 1 --disable=all --enable=relative-beyond-top-level --source-roots . a/c/d.py
# This one is not, and produces the output shown below:
pylint --jobs 0 --disable=all --enable=relative-beyond-top-level --source-roots . a/c/d.pyPylint output
************* Module d
a/c/d.py:1:0: E0402: Attempted relative import beyond top-level package (relative-beyond-top-level)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)Expected behavior
pylint should be successful in both calls.
Pylint version
pylint 4.0.4
astroid 4.0.2
Python 3.13.11 (main, Dec 7 2025, 13:01:45) [GCC 15.2.1 20251112]OS / Environment
No response
Additional dependencies
Metadata
Metadata
Assignees
Labels
False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeNeeds investigation 🔬A bug or crash where it's not immediately obvious what is happenningA bug or crash where it's not immediately obvious what is happenningmultiprocessingnamespace-package