#4795 inspect.isgeneratorfunction() should return False instead of None

This commit is contained in:
Benjamin Peterson 2008-12-31 23:48:39 +00:00
parent 3cda1db67f
commit 8ad09a4f2e
2 changed files with 4 additions and 0 deletions

View File

@ -161,6 +161,7 @@ def isgeneratorfunction(object):
if (isfunction(object) or ismethod(object)) and \
object.func_code.co_flags & CO_GENERATOR:
return True
return False
def isgenerator(object):
"""Return true if the object is a generator.

View File

@ -100,6 +100,9 @@ Core and Builtins
Library
-------
- Issue #4795: inspect.isgeneratorfunction() returns False instead of None when
the function is not a generator.
- Issue #4702: Throwing a DistutilsPlatformError instead of IOError in case
no MSVC compiler is found under Windows. Original patch by Philip Jenvey.