Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r85749:640aead9d130
Date: 2016-07-18 11:07 +0200
http://bitbucket.org/pypy/pypy/changeset/640aead9d130/

Log:    Fix for test_os.py on Windows

diff --git a/pypy/module/posix/interp_posix.py 
b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -544,6 +544,14 @@
         raise oefmt(space.w_ValueError,
                     "the environment variable is longer than %d bytes",
                     _MAX_ENV)
+    if _WIN32 and not objectmodel.we_are_translated() and value == '':
+        # special case: on Windows, _putenv("NAME=") really means that
+        # we want to delete NAME.  So that's what the os.environ[name]=''
+        # below will do after translation.  But before translation, it
+        # will cache the environment value '' instead of <missing> and
+        # then return that.  We need to avoid that.
+        del os.environ[name]
+        return
     try:
         os.environ[name] = value
     except OSError as e:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to