changeset: 102697:3ff02380b1bf branch: 3.5 parent: 102695:a42933335897 user: Gregory P. Smith date: Mon Aug 15 23:23:40 2016 -0700 files: Lib/unittest/mock.py description: Issue #26750: use inspect.isdatadescriptor instead of our own _is_data_descriptor(). diff -r a42933335897 -r 3ff02380b1bf Lib/unittest/mock.py --- a/Lib/unittest/mock.py Tue Aug 16 01:44:12 2016 -0400 +++ b/Lib/unittest/mock.py Mon Aug 15 23:23:40 2016 -0700 @@ -72,12 +72,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 @@ -2138,7 +2132,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 = {}