changeset: 102698:d51a66622266 parent: 102696:965a6a5539f2 parent: 102697:3ff02380b1bf user: Gregory P. Smith date: Mon Aug 15 23:56:32 2016 -0700 files: Lib/unittest/mock.py description: Issue #26750: use inspect.isdatadescriptor instead of our own _is_data_descriptor(). diff -r 965a6a5539f2 -r d51a66622266 Lib/unittest/mock.py --- a/Lib/unittest/mock.py Tue Aug 16 01:44:31 2016 -0400 +++ b/Lib/unittest/mock.py Mon Aug 15 23:56:32 2016 -0700 @@ -60,12 +60,6 @@ ) -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 @@ -2149,7 +2143,7 @@ _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 = {}