Skip to content

Commit 525c047

Browse files
committed
Small refact
1 parent 33c8b1f commit 525c047

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

Lib/subprocess.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -769,18 +769,15 @@ def _can_use_pidfd_open():
769769

770770
def _can_use_kqueue():
771771
# Availability: macOS, BSD
772-
if not all(
773-
hasattr(select, x)
774-
for x in (
775-
"kqueue",
776-
"KQ_EV_ADD",
777-
"KQ_EV_ONESHOT",
778-
"KQ_FILTER_PROC",
779-
"KQ_NOTE_EXIT",
780-
)
781-
):
772+
names = (
773+
"kqueue",
774+
"KQ_EV_ADD",
775+
"KQ_EV_ONESHOT",
776+
"KQ_FILTER_PROC",
777+
"KQ_NOTE_EXIT",
778+
)
779+
if not all(hasattr(select, x) for x in names):
782780
return False
783-
784781
kq = None
785782
try:
786783
kq = select.kqueue()
@@ -790,7 +787,7 @@ def _can_use_kqueue():
790787
flags=select.KQ_EV_ADD | select.KQ_EV_ONESHOT,
791788
fflags=select.KQ_NOTE_EXIT,
792789
)
793-
events = kq.control([kev], 1, 0)
790+
kq.control([kev], 1, 0)
794791
return True
795792
except OSError as err:
796793
if err.errno in {errno.EMFILE, errno.ENFILE}:

0 commit comments

Comments
 (0)