Skip to content

Commit 15accee

Browse files
committed
Also display legacy package error if global ignore_missing_imports is enabled
1 parent fc0bf79 commit 15accee

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

mypy/build.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2381,10 +2381,21 @@ def find_module_and_diagnose(manager: BuildManager,
23812381
# Could not find a module. Typically the reason is a
23822382
# misspelled module name, missing stub, module not in
23832383
# search path or the module has not been installed.
2384+
2385+
ignore_missing_imports = options.ignore_missing_imports
2386+
top_level = file_id.partition('.')[0]
2387+
# Don't honor a global (not per-module) ignore_missing_imports
2388+
# setting for modules that used to have bundled stubs, as
2389+
# otherwise updating mypy can silently result in new false
2390+
# negatives.
2391+
global_ignore_missing_imports = manager.options.ignore_missing_imports
2392+
if top_level in legacy_bundled_packages and global_ignore_missing_imports:
2393+
ignore_missing_imports = False
2394+
23842395
if skip_diagnose:
23852396
raise ModuleNotFound
23862397
if caller_state:
2387-
if not (options.ignore_missing_imports or in_partial_package(id, manager)):
2398+
if not (ignore_missing_imports or in_partial_package(id, manager)):
23882399
module_not_found(manager, caller_line, caller_state, id, result)
23892400
raise ModuleNotFound
23902401
elif root_source:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy