mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	bpo-40838: document getdoc, getmodule, getsourcefile in inspect returns None (GH-30575)
				
					
				
			Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit b86d783a4e)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
			
			
This commit is contained in:
		
							parent
							
								
									36da1a77c6
								
							
						
					
					
						commit
						9a61afec20
					
				
					 2 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -512,6 +512,7 @@ Retrieving source code
 | 
			
		|||
   If the documentation string for an object is not provided and the object is
 | 
			
		||||
   a class, a method, a property or a descriptor, retrieve the documentation
 | 
			
		||||
   string from the inheritance hierarchy.
 | 
			
		||||
   Return ``None`` if the documentation string is invalid or missing.
 | 
			
		||||
 | 
			
		||||
   .. versionchanged:: 3.5
 | 
			
		||||
      Documentation strings are now inherited if not overridden.
 | 
			
		||||
| 
						 | 
				
			
			@ -535,12 +536,14 @@ Retrieving source code
 | 
			
		|||
 | 
			
		||||
.. function:: getmodule(object)
 | 
			
		||||
 | 
			
		||||
   Try to guess which module an object was defined in.
 | 
			
		||||
   Try to guess which module an object was defined in. Return ``None``
 | 
			
		||||
   if the module cannot be determined.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.. function:: getsourcefile(object)
 | 
			
		||||
 | 
			
		||||
   Return the name of the Python source file in which an object was defined.  This
 | 
			
		||||
   Return the name of the Python source file in which an object was defined
 | 
			
		||||
   or ``None`` if no way can be identified to get the source.  This
 | 
			
		||||
   will fail with a :exc:`TypeError` if the object is a built-in module, class, or
 | 
			
		||||
   function.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
Document that :func:`inspect.getdoc`, :func:`inspect.getmodule`, and
 | 
			
		||||
:func:`inspect.getsourcefile` might return ``None``.
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue