Skip to content

reportShadowedImports doesn't report diagnostics for files that are overriding a stdlib module #5979

Description

@StellaHuang95

Environment data

  • Language Server version: 2024.6.1
  • OS and version: XXX
  • Python version (& distribution if applicable, e.g. Anaconda): XXX

Repro Steps

  1. Create a workspace in VSCode
  2. Set the "reportShadowedImports": "error" in settings.json
  3. Create 2 python files sys.py and mailbox.py

Expected behavior

I am expecting to see 2 diagnostics:

"xxx\folder1\mailbox.py" is overriding the stdlib module "mailbox"
and
"xxx\folder1\sys.py" is overriding the stdlib module "sys"

Actual behavior

Only getting 1 diagnostic:

"xxx\folder1\mailbox.py" is overriding the stdlib module "mailbox"

Only repros with certain stdlib modules such as os, json, sys

Metadata

Metadata

Assignees

Labels

fixed in next version (main)A fix has been implemented and will appear in an upcoming versionrepro workspaceIssue has a retained repro workspace

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions