summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Rosmaita <rosmaita.fossdev@gmail.com>2022-03-01 12:50:33 -0500
committerBrian Rosmaita <rosmaita.fossdev@gmail.com>2022-03-01 13:05:22 -0500
commita937c5562f7cca721972822d72ae7d2915bd5d52 (patch)
treecb9b0d71442aaf926525d45ce3136b1d2b1311bf
parent95b9334cfab6849fbe47e2b118e5355af3675dba (diff)
downloadoslo-concurrency-a937c5562f7cca721972822d72ae7d2915bd5d52.tar.gz
Allow python_exec kwarg to be None
processutils.execute() is documented to take a python_exec kwarg and default to using sys.executable if that argument isn't set. It is convenient (and more intuitive) for this behavior to also occur if the argument is present with value None. Closes-bug: #1962603 Related-bug: #1962581 Change-Id: I2e1f187feaf4bf9fbfaf04fce78efa0cba49fc07
-rw-r--r--oslo_concurrency/processutils.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/oslo_concurrency/processutils.py b/oslo_concurrency/processutils.py
index fea5ecd..dea5b7a 100644
--- a/oslo_concurrency/processutils.py
+++ b/oslo_concurrency/processutils.py
@@ -269,8 +269,8 @@ def execute(*cmd, **kwargs):
below for a detailed description.
:type prlimit: :class:`ProcessLimits`
:param python_exec: The python executable to use for enforcing
- prlimits. If this is not set it will default to use
- sys.executable.
+ prlimits. If this is not set or is None, it will
+ default to use sys.executable.
:type python_exec: string
:param timeout: Timeout (in seconds) to wait for the process
termination. If timeout is reached,
@@ -329,7 +329,7 @@ def execute(*cmd, **kwargs):
on_completion = kwargs.pop('on_completion', None)
preexec_fn = kwargs.pop('preexec_fn', None)
prlimit = kwargs.pop('prlimit', None)
- python_exec = kwargs.pop('python_exec', sys.executable)
+ python_exec = kwargs.pop('python_exec', None) or sys.executable
timeout = kwargs.pop('timeout', None)
if isinstance(check_exit_code, bool):