forked from Rust-related/RustPython
PR feedback: comment out original inspect.isabstract code
This commit is contained in:
7
Lib/inspect.py
vendored
7
Lib/inspect.py
vendored
@@ -300,15 +300,18 @@ def isroutine(object):
|
||||
|
||||
def isabstract(object):
|
||||
"""Return true if the object is an abstract base class (ABC)."""
|
||||
# TODO: RUSTPYTHON
|
||||
# TPFLAGS_IS_ABSTRACT is not being set for abstract classes, so this implementation differs from CPython.
|
||||
if not isinstance(object, type):
|
||||
return False
|
||||
# TODO: RUSTPYTHON
|
||||
# TPFLAGS_IS_ABSTRACT is not being set for abstract classes, so this implementation differs from CPython.
|
||||
# if object.__flags__ & TPFLAGS_IS_ABSTRACT:
|
||||
# return True
|
||||
if not issubclass(type(object), abc.ABCMeta):
|
||||
return False
|
||||
if hasattr(object, '__abstractmethods__'):
|
||||
# It looks like ABCMeta.__new__ has finished running;
|
||||
# TPFLAGS_IS_ABSTRACT should have been accurate.
|
||||
# return False
|
||||
return bool(getattr(object, '__abstractmethods__'))
|
||||
# It looks like ABCMeta.__new__ has not finished running yet; we're
|
||||
# probably in __init_subclass__. We'll look for abstractmethods manually.
|
||||
|
||||
Reference in New Issue
Block a user