do not discard ImportError message in ImageFont

This commit is contained in:
nulano 2023-03-31 01:48:17 +02:00
parent 1f0573f2d6
commit b18efc775d
No known key found for this signature in database
GPG Key ID: B650CDF63B705766

View File

@ -54,17 +54,12 @@ def __getattr__(name):
raise AttributeError(msg)
class _ImagingFtNotInstalled:
# module placeholder
def __getattr__(self, id):
msg = "The _imagingft C module is not installed"
raise ImportError(msg)
try:
from . import _imagingft as core
except ImportError:
core = _ImagingFtNotInstalled()
except ImportError as ex:
from ._util import DeferredError
core = DeferredError(ex)
_UNSPECIFIED = object()