Avoid invoking the parser/compiler just to test the presence of a function.

This commit is contained in:
Amaury Forgeot d'Arc 2009-06-09 22:53:16 +00:00
parent 6a098d20e4
commit 03dcc73c11
1 changed files with 1 additions and 5 deletions

View File

@ -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"):