Kaydet (Commit) d4583d7f authored tarafından Gregory P. Smith's avatar Gregory P. Smith

Issue #26750: use inspect.isdatadescriptor instead of our own

_is_data_descriptor().
üst 22ba01ea
......@@ -72,12 +72,6 @@ DescriptorTypes = (
)
def _is_data_descriptor(obj):
# Data descriptors are Properties, slots, getsets and C data members.
return ((hasattr(obj, '__set__') or hasattr(obj, '__del__')) and
hasattr(obj, '__get__'))
def _get_signature_object(func, as_instance, eat_self):
"""
Given an arbitrary, possibly callable object, try to create a suitable
......@@ -2138,7 +2132,7 @@ def create_autospec(spec, spec_set=False, instance=False, _parent=None,
_kwargs.update(kwargs)
Klass = MagicMock
if _is_data_descriptor(spec):
if inspect.isdatadescriptor(spec):
# descriptors don't have a spec
# because we don't know what type they return
_kwargs = {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment