Skip to content

v2.17.0 regression related to W0407: preferred-modules #8453

Closed
@ssbarnea

Description

@ssbarnea

Bug description

v2.17.0 release broke the W0407 rule by making the match trigger on partial string match.

# now failing due to 'py' being part of the imported name:
import copy
# some:
import pytest

This was working fine in v2.16.3 but now we need to disable preffered-modules for the moment.

Configuration

[tool.pylint.IMPORTS]
preferred-modules = ["py:pathlib", "unittest:pytest"]

Command used

-

Pylint output

W0407: Prefer importing 'pathlib' instead of 'py' (preferred-module)

Expected behavior

No error

Pylint version

$ pylint --version
pylint 2.17.0
astroid 2.15.0
Python 3.11.2 (main, Feb 16 2023, 11:46:09) [Clang 14.0.0 (clang-1400.0.29.202)]

OS / Environment

No response

Additional dependencies

No response

Related: #7957

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🪲Needs PRThis issue is accepted, sufficiently specified and now needs an implementationRegression

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions