mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-09-24 13:07:00 +03:00
Allow pyright to "see" core properly
Without this change, the following file raises errors (in strict mode) and reveals the type as "Unknown". After this change, the type is correctly revealed as "ImagingCore". # pyright: strict from PIL import Image img = Image.new('RGB', (10, 10)) data = img.getdata() reveal_type(data)
This commit is contained in:
parent
34c651deb8
commit
9240ec96c0
|
@ -86,6 +86,9 @@ WARN_POSSIBLE_FORMATS: bool = False
|
|||
MAX_IMAGE_PIXELS: int | None = int(1024 * 1024 * 1024 // 4 // 3)
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from . import _imaging as core
|
||||
else:
|
||||
try:
|
||||
# If the _imaging C module is not present, Pillow will not load.
|
||||
# Note that other modules should not refer to _imaging directly;
|
||||
|
|
Loading…
Reference in New Issue
Block a user