<p>That&#39;s why I&#39;m suggesting we look specifically at the cases where *Python* misbehaves in an empty environment on Windows. Those are legitimately our issue. </p>
<p>The problem in *general* is a platform one, so I don&#39;t think it makes sense for us to modify the environment that has explicitly been passed in (e.g. how would you test running without SystemRoot if subprocess added it automatically?). </p>

<p>An extra parameter in the already confusing Popen signature wouldn&#39;t be clearer than explicitly copying os.environ and modifying it.</p>
<p>--<br>
Nick Coghlan (via Gmail on Android, so likely to be more terse than usual)</p>
<div class="gmail_quote">On Dec 4, 2011 10:22 PM, &quot;Tim Golden&quot; &lt;<a href="mailto:mail@timgolden.me.uk">mail@timgolden.me.uk</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 04/12/2011 11:42, Nick Coghlan wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
There&#39;s actually two questions to be answered:<br>
1. What should we do in 3.2 and 2.7?<br>
2. Should we do anything more in 3.3?<br>
</blockquote>
<br>
Agreed.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1. Unset &#39;SystemRoot&#39; in a windows shell<br>
2. Run the test suite and observe the scale of the breakage<br>
</blockquote>
<br>
Sorry; something I should have highlighted in the earlier post.<br>
Behaviour varies between Windows versions. On WinXP, if you<br>
unset SystemRoot in a cmd shell, you won&#39;t be able to run the<br>
test suite: Python won&#39;t even start up. On Win7 Python will<br>
start but, eg, the random module will fail.<br>
<br>
This is actually a separate issue: how much of Python will work<br>
without a valid SystemRoot. The OP&#39;s issue was that if you use<br>
subprocess to start an arbitrary process (you get the same problem<br>
if you try &quot;notepad.exe&quot;) and pass it an env block without a valid<br>
SystemRoot then that process will likely fail to start up. And it<br>
won&#39;t be obvious why.<br>
<br>
The case where someone tries to run Python (in general) without<br>
a valid SystemRoot is a tiny cornercase and you&#39;d be quite right<br>
to push that back and say &quot;Don&#39;t do that&quot;. I don&#39;t believe we have<br>
to test for it or add code to work around it.<br>
<br>
While I put the idea forward, I agree that an exception is more likely<br>
than not to break existing code. I just can&#39;t see any clear alternative,<br>
apart from option 1: we do nothing.<br>
<br>
TJG<br>
______________________________<u></u>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-dev" target="_blank">http://mail.python.org/<u></u>mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com" target="_blank">http://mail.python.org/<u></u>mailman/options/python-dev/<u></u>ncoghlan%40gmail.com</a><br>
</blockquote></div>