Skip to content

Commit ac1f10f

Browse files
authored
Merge pull request #7576 from deliangyang/main
Import plugins relative to the module
2 parents 0ae1377 + b235aa9 commit ac1f10f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/PIL/Image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,11 @@ def init():
355355
if _initialized >= 2:
356356
return 0
357357

358+
parent_name = __name__.rpartition(".")[0]
358359
for plugin in _plugins:
359360
try:
360361
logger.debug("Importing %s", plugin)
361-
__import__(f"PIL.{plugin}", globals(), locals(), [])
362+
__import__(f"{parent_name}.{plugin}", globals(), locals(), [])
362363
except ImportError as e:
363364
logger.debug("Image: failed to import %s: %s", plugin, e)
364365

0 commit comments

Comments
 (0)