Change all the function attributes from func_* -> __*__. This gets rid
of func_name, func_dict and func_doc as they already exist as __name__,
__dict__ and __doc__.
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 986a415..e87d3e2 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -2,7 +2,7 @@
"""Get useful information from live Python objects.
This module encapsulates the interface provided by the internal special
-attributes (func_*, co_*, im_*, tb_*, etc.) in a friendlier fashion.
+attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.
Here are some of the useful functions provided by this module:
@@ -129,11 +129,11 @@
Function objects provide these attributes:
__doc__ documentation string
__name__ name with which this function was defined
- func_code code object containing compiled function bytecode
- func_defaults tuple of any default values for arguments
- func_doc (same as __doc__)
- func_globals global namespace in which this function was defined
- func_name (same as __name__)"""
+ __code__ code object containing compiled function bytecode
+ __defaults__ tuple of any default values for arguments
+ __globals__ global namespace in which this function was defined
+ __annotations__ dict of parameter annotations
+ __kwdefaults__ dict of keyword only parameters with defaults"""
return isinstance(object, types.FunctionType)
def istraceback(object):
@@ -353,7 +353,7 @@
if ismethod(object):
object = object.im_func
if isfunction(object):
- object = object.func_code
+ object = object.__code__
if istraceback(object):
object = object.tb_frame
if isframe(object):
@@ -496,7 +496,7 @@
if ismethod(object):
object = object.im_func
if isfunction(object):
- object = object.func_code
+ object = object.__code__
if istraceback(object):
object = object.tb_frame
if isframe(object):
@@ -741,8 +741,8 @@
func = func.im_func
if not isfunction(func):
raise TypeError('arg is not a Python function')
- args, varargs, varkw = getargs(func.func_code)
- return args, varargs, varkw, func.func_defaults
+ args, varargs, varkw = getargs(func.__code__)
+ return args, varargs, varkw, func.__defaults__
def getargvalues(frame):
"""Get information about arguments passed into a particular frame.