mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	Issue #26750: use inspect.isdatadescriptor instead of our own
_is_data_descriptor().
This commit is contained in:
		
						commit
						c35a32fe85
					
				
					 1 changed files with 1 additions and 7 deletions
				
			
		| 
						 | 
					@ -60,12 +60,6 @@ def _is_exception(obj):
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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):
 | 
					def _get_signature_object(func, as_instance, eat_self):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Given an arbitrary, possibly callable object, try to create a suitable
 | 
					    Given an arbitrary, possibly callable object, try to create a suitable
 | 
				
			||||||
| 
						 | 
					@ -2149,7 +2143,7 @@ def create_autospec(spec, spec_set=False, instance=False, _parent=None,
 | 
				
			||||||
    _kwargs.update(kwargs)
 | 
					    _kwargs.update(kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Klass = MagicMock
 | 
					    Klass = MagicMock
 | 
				
			||||||
    if _is_data_descriptor(spec):
 | 
					    if inspect.isdatadescriptor(spec):
 | 
				
			||||||
        # descriptors don't have a spec
 | 
					        # descriptors don't have a spec
 | 
				
			||||||
        # because we don't know what type they return
 | 
					        # because we don't know what type they return
 | 
				
			||||||
        _kwargs = {}
 | 
					        _kwargs = {}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue