pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

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

Open StellaHuang95 opened this issue 8 months ago • 1 comments

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

StellaHuang95 avatar Jun 06 '24 21:06 StellaHuang95