MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _silence_resource_warning

Function _silence_resource_warning

pymongo/daemon.py:43–54  ·  view source on GitHub ↗

Silence Popen's ResourceWarning. Note this should only be used if the process was created as a daemon.

(popen: Optional[subprocess.Popen[Any]])

Source from the content-addressed store, hash-verified

41
42
43def _silence_resource_warning(popen: Optional[subprocess.Popen[Any]]) -> None:
44 """Silence Popen's ResourceWarning.
45
46 Note this should only be used if the process was created as a daemon.
47 """
48 # Set the returncode to avoid this warning when popen is garbage collected:
49 # "ResourceWarning: subprocess XXX is still running".
50 # See https://bugs.python.org/issue38890 and
51 # https://bugs.python.org/issue26741.
52 # popen is None when mongocryptd spawning fails
53 if popen is not None:
54 popen.returncode = 0
55
56
57if sys.platform == "win32":

Callers 2

_spawn_daemonFunction · 0.85
daemon.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected