Always define getenv(), as suggested by Guido. This means that os.getenv() is also defined for MacPython-OS9 (even though it doesn't actually do anything useful), and it shouldn't hurt on other platforms.
This commit is contained in:
parent
52941a8348
commit
b11ce9b96c
10
Lib/os.py
10
Lib/os.py
|
@ -416,11 +416,11 @@ else:
|
||||||
|
|
||||||
environ = _Environ(environ)
|
environ = _Environ(environ)
|
||||||
|
|
||||||
def getenv(key, default=None):
|
def getenv(key, default=None):
|
||||||
"""Get an environment variable, return None if it doesn't exist.
|
"""Get an environment variable, return None if it doesn't exist.
|
||||||
The optional second argument can specify an alternate default."""
|
The optional second argument can specify an alternate default."""
|
||||||
return environ.get(key, default)
|
return environ.get(key, default)
|
||||||
__all__.append("getenv")
|
__all__.append("getenv")
|
||||||
|
|
||||||
def _exists(name):
|
def _exists(name):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue