[3.13] gh-119253: use ImportError in _ios_support (GH-119254) (#119265)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2024-05-21 00:21:28 +02:00 committed by GitHub
parent 572b0b0809
commit 071d996e13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ except ImportError:
# ctypes is an optional module. If it's not present, we're limited in what # ctypes is an optional module. If it's not present, we're limited in what
# we can tell about the system, but we don't want to prevent the module # we can tell about the system, but we don't want to prevent the module
# from working. # from working.
print("ctypes isn't available; iOS system calls will not be available") print("ctypes isn't available; iOS system calls will not be available", file=sys.stderr)
objc = None objc = None
else: else:
# ctypes is available. Load the ObjC library, and wrap the objc_getClass, # ctypes is available. Load the ObjC library, and wrap the objc_getClass,
@ -13,7 +13,7 @@ else:
lib = util.find_library("objc") lib = util.find_library("objc")
if lib is None: if lib is None:
# Failed to load the objc library # Failed to load the objc library
raise RuntimeError("ObjC runtime library couldn't be loaded") raise ImportError("ObjC runtime library couldn't be loaded")
objc = cdll.LoadLibrary(lib) objc = cdll.LoadLibrary(lib)
objc.objc_getClass.restype = c_void_p objc.objc_getClass.restype = c_void_p