Skip to content

Commit e2e5421

Browse files
committed
fix: fix the corner case when variable is None
Sometimes application developers set the value of an environment variable to None. This fix adds a guard for mitigating this issue to prevent python from crashing. Signed-off-by: Tianrui Wei <tianrui@tianruiwei.com>
1 parent b9dedfe commit e2e5421

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/subprocess.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,6 +1815,8 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
18151815
if env is not None:
18161816
env_list = []
18171817
for k, v in env.items():
1818+
if v is None:
1819+
continue
18181820
k = os.fsencode(k)
18191821
if b'=' in k:
18201822
raise ValueError("illegal environment variable name")

0 commit comments

Comments
 (0)