diff options
author | Guido van Rossum <guido@python.org> | 1998-08-04 16:01:23 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-08-04 16:01:23 (GMT) |
commit | da4d6daa4a4a95f7031f9b8c3e76222ec4fd509e (patch) | |
tree | d1671b4ed83c5208bfaff6de65bde7ef4b853f0c /Lib | |
parent | 7f875ef74993a32e6206d728677be29ab43e719d (diff) | |
download | cpython-da4d6daa4a4a95f7031f9b8c3e76222ec4fd509e.zip cpython-da4d6daa4a4a95f7031f9b8c3e76222ec4fd509e.tar.gz cpython-da4d6daa4a4a95f7031f9b8c3e76222ec4fd509e.tar.bz2 |
Support case insensitive treatment of os.environ keys on Windows and
DOS (as well as OS/2). I presume that making a call to putenv() with
a lowercase key will actually do the right thing. I know this is so
on Windows/DOS, and I expect it is so OS/2 -- but the old OS/2 code
didn't assume this. (I don't know if the person who provided the OS/2
patch was clueless or just didn't care about DOS and Windows.)
Also ripped out the support for pickling -- as of 1.5, this is no
longer needed to make pickling work.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/os.py | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -226,15 +226,19 @@ except NameError: else: import UserDict - if name in ('os2', ): # Where Env Var Names Must Be UPPERCASE + if name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE + # But we store them as upper case import string class _Environ(UserDict.UserDict): def __init__(self, environ): UserDict.UserDict.__init__(self) - self.data = environ + data = self.data + upper = string.upper + for k, v in environ.items(): + data[upper(k)] = v def __setitem__(self, key, item): - key = string.upper(key) putenv(key, item) + key = string.upper(key) self.data[key] = item def __getitem__(self, key): return self.data[string.upper(key)] @@ -244,13 +248,8 @@ else: def __init__(self, environ): UserDict.UserDict.__init__(self) self.data = environ - def __getinitargs__(self): - import copy - return (copy.copy(self.data),) def __setitem__(self, key, item): putenv(key, item) self.data[key] = item - def __copy__(self): - return _Environ(self.data.copy()) environ = _Environ(environ) |