This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 vstinner
收信人 amaury.forgeotdarc, ezio.melotti, vstinner
日期 2011-11-17.00:45:41
SpamBayes Score 9.6560155e-09
Marked as misclassified
Message-id <1321490742.62.0.303878841436.issue13415@psf.upfronthosting.co.za>
In-reply-to
内容
> But... there is no os.unsetenv on Windows!

Correct, even unsetenv() doesn't exist on Windows: putenv() can be used to unset a variable using an empty value. And it's exactly what Python does.

It is confusing because posix_unsetenv() is not build on Windows, but it contains code specific for Windows.

While testing del os.environ[key], I found another bug: del os.environ['x'*50000] does crash Python on Windows.

Attached patch (for Python 3.3) does:

 - Remove the Windows specific code from posix_unsetenv()
 - Check if unsetenv() failed on UNIX
 - Check environment variable length on Windows

The Windows bug does affect Python 2.7 too. "Check if unsetenv() failed on UNIX" change may be skipped on Python 2.7 and 3.2.
历史
日期 用户 动作 参数
2011-11-17 00:45:42vstinner修改recipients: + vstinner, amaury.forgeotdarc, ezio.melotti
2011-11-17 00:45:42vstinner修改messageid: <1321490742.62.0.303878841436.issue13415@psf.upfronthosting.co.za>
2011-11-17 00:45:42vstinner链接issue13415 messages
2011-11-17 00:45:41vstinner创建