mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-07-11 02:03:22 +00:00
Use "with suppress()" to suppress a python exception
This commit is contained in:
parent
8d21a5b6b3
commit
78775b7f6b
1 changed files with 2 additions and 3 deletions
|
|
@ -3,6 +3,7 @@
|
|||
# License: GPLv3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import sys
|
||||
from contextlib import suppress
|
||||
|
||||
from .constants import is_macos
|
||||
|
||||
|
|
@ -18,11 +19,9 @@ else:
|
|||
def load_libxkb_lookup():
|
||||
import ctypes
|
||||
for suffix in ('.0', ''):
|
||||
try:
|
||||
with suppress(Exception):
|
||||
lib = ctypes.CDLL('libxkbcommon.so' + suffix)
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
from ctypes.util import find_library
|
||||
lib = find_library('xkbcommon')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue