From be7bd4be4fea94bd41253b71acb8aedb3833d7a8 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Mon, 30 Mar 2020 16:39:48 +0200 Subject: [PATCH] [FIX] PYTHONPATH grew run-to-run. Fix #31 --- wexpect/host.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wexpect/host.py b/wexpect/host.py index b2c8336..9ac1b5e 100644 --- a/wexpect/host.py +++ b/wexpect/host.py @@ -351,7 +351,8 @@ class SpawnBase: console_args = f" {console_class_parameters_str} -- {args_str}" # set environment variables for the console - environ = os.environ + # Deep copy needed to prevent cycle-to-cycle growth. See #31 for more details. + environ = os.environ.copy() if getattr(sys, 'frozen', False): '''Runing in a PyInstaller bundle: