import builtins
import errno
import io
+import locale
import os
import time
+import signal
import sys
import threading
import warnings
def __str__(self):
if self.returncode and self.returncode < 0:
- # Lazy import to improve module import time
- import signal
try:
return "Command '%s' died with %r." % (
self.cmd, signal.Signals(-self.returncode))
if sys.flags.utf8_mode:
return "utf-8"
else:
- # Lazy import to improve module import time
- import locale
return locale.getencoding()
# Don't signal a process that we know has already died.
if self.returncode is not None:
return
-
- # Lazy import to improve module import time
- import signal
if sig == signal.SIGTERM:
self.terminate()
elif sig == signal.CTRL_C_EVENT:
"""Execute program using os.posix_spawn()."""
kwargs = {}
if restore_signals:
- # Lazy import to improve module import time
- import signal
-
# See _Py_RestoreSignals() in Python/pylifecycle.c
sigset = []
for signame in ('SIGPIPE', 'SIGXFZ', 'SIGXFSZ'):
def terminate(self):
"""Terminate the process with SIGTERM
"""
- # Lazy import to improve module import time
- import signal
self.send_signal(signal.SIGTERM)
def kill(self):
"""Kill the process with SIGKILL
"""
- # Lazy import to improve module import time
- import signal
self.send_signal(signal.SIGKILL)
--- /dev/null
+Reverts a change in the previous release attempting to make some stdlib
+imports used within the :mod:`subprocess` module lazy as this was causing
+errors during ``__del__`` finalizers calling methods such as ``terminate``, or
+``kill``, or ``send_signal``.