[New-bugs-announce] [issue28824] os.environ should preserve the case of the OS keys ?

tzickel report at bugs.python.org
Mon Nov 28 13:55:46 EST 2016


New submission from tzickel:

In Windows, python's os.environ currently handles the case sensitivity different that the OS. While it's true that the OS is case insensitive, it does preserve the case that you first set it as.

For example:
C:\Users\user>set aSD=Blah
C:\Users\user>set asd
aSD=Blah

But in python:
>>> import os
>>> 'aSD' in os.environ.keys()
False

Today as more people pass environment variables to processes, it's better to behave as the OS does. Basically I think that os.environ (both in 2.7 and 3) should preserve the case as well (for when you need to access / iterate over the keys or set a key), but ignore it when you get a key.

https://github.com/python/cpython/blob/b82a5a65caa5b0f0efccaf2bbea94f1eba19a54d/Lib/os.py#L733

----------
components: Windows
messages: 281906
nosy: larry, loewis, paul.moore, steve.dower, tim.golden, tzickel, zach.ware
priority: normal
severity: normal
status: open
title: os.environ should preserve the case of the OS keys ?
versions: Python 2.7, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28824>
_______________________________________


More information about the New-bugs-announce mailing list