diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2009-06-09 22:53:16 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2009-06-09 22:53:16 (GMT) |
commit | 03dcc73c1121ebccc49af4cb5ff2d4aa8ca833db (patch) | |
tree | 7a484e13f70de12c86b2ac560966eb074718b0e4 /Lib/os.py | |
parent | 6a098d20e46c7d9f87dbf411a1611fa386d835e1 (diff) | |
download | cpython-03dcc73c1121ebccc49af4cb5ff2d4aa8ca833db.zip cpython-03dcc73c1121ebccc49af4cb5ff2d4aa8ca833db.tar.gz cpython-03dcc73c1121ebccc49af4cb5ff2d4aa8ca833db.tar.bz2 |
Avoid invoking the parser/compiler just to test the presence of a function.
Diffstat (limited to 'Lib/os.py')
-rw-r--r-- | Lib/os.py | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -514,11 +514,7 @@ def getenv(key, default=None): __all__.append("getenv") def _exists(name): - try: - eval(name) - return True - except NameError: - return False + return name in globals() # Supply spawn*() (probably only for Unix) if _exists("fork") and not _exists("spawnv") and _exists("execv"): |