From: Barry Warsaw <barry@python.org>
Date: Mon, 1 Mar 2010 21:56:18 +0000 (+0000)
Subject: Manually copy patch for bug 7250 from the release26-maint branch.  I suck
X-Git-Tag: v3.1.2rc1~21
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0712921ef993159a0e37cf986843a91833073ca5;p=python

Manually copy patch for bug 7250 from the release26-maint branch.  I suck
because I did this in the wrong order and couldn't smack svnmerge into
submission.
---

diff --git a/Lib/wsgiref/handlers.py b/Lib/wsgiref/handlers.py
index e082823d35..8a78eecf20 100644
--- a/Lib/wsgiref/handlers.py
+++ b/Lib/wsgiref/handlers.py
@@ -465,6 +465,10 @@ class CGIHandler(BaseCGIHandler):
     """
 
     wsgi_run_once = True
+    # Do not allow os.environ to leak between requests in Google App Engine
+    # and other multi-run CGI use cases.  This is not easily testable.
+    # See http://bugs.python.org/issue7250
+    os_environ = {}
 
     def __init__(self):
         BaseCGIHandler.__init__(
diff --git a/Misc/NEWS b/Misc/NEWS
index 55700b726a..68619ea691 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -94,6 +94,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #7250: Fix info leak of os.environ across multi-run uses of
+  wsgiref.handlers.CGIHandler.
+
 - Issue #1729305: Fix doctest to handle encode error with "backslashreplace".
 
 - Issue #691291: codecs.open() should not convert end of lines on reading and