diff options
author | Barry Warsaw <barry@python.org> | 1997-12-01 04:30:19 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1997-12-01 04:30:19 (GMT) |
commit | 58a88b3e34f7b992a33ee93001bf6d795acd7f32 (patch) | |
tree | 1cff4cff9620df6c1cd33e0edfab1f416f4cdf29 /Lib/os.py | |
parent | 798654fc68ea3cdc06c6af56c236db5f71dd7157 (diff) | |
download | cpython-58a88b3e34f7b992a33ee93001bf6d795acd7f32.zip cpython-58a88b3e34f7b992a33ee93001bf6d795acd7f32.tar.gz cpython-58a88b3e34f7b992a33ee93001bf6d795acd7f32.tar.bz2 |
_Environ(): Added __getinitargs__() method so os.environ.copy() works,
as does unpickling, as in: pickle.loads(pickle.dumps(os.environ)).
Hope this is right! Don't shoot me Guido. :-)
Diffstat (limited to 'Lib/os.py')
-rw-r--r-- | Lib/os.py | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -162,8 +162,13 @@ 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) |