Fix spurious warning from runpy module when prewarmed

This commit is contained in:
Kovid Goyal 2022-06-08 19:10:06 +05:30
parent c8399ce3d2
commit 7001d609fa
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -7,6 +7,7 @@
import select
import sys
import time
import warnings
from contextlib import suppress
from dataclasses import dataclass
from importlib import import_module
@ -338,6 +339,9 @@ def main(notify_child_death_fd: int) -> None:
child_id_map: Dict[int, int] = {}
child_id_counter = count()
self_pid = os.getpid()
# runpy issues a warning when running modules that have already been
# imported. Ignore it.
warnings.filterwarnings('ignore', category=RuntimeWarning, module='runpy')
def check_event(event: int, err_msg: str) -> None:
if event & select.POLLHUP: