summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2021-12-10 23:05:23 (GMT)
committerGitHub <noreply@github.com>2021-12-10 23:05:23 (GMT)
commit810c1769f1c24ed907bdf3cc1086db4e602a28ae (patch)
tree22c3c684aacf875042c5783ec72560f293e58acd
parent0fe104fce7da709edddb701baa2249e3275db1fd (diff)
downloadcpython-810c1769f1c24ed907bdf3cc1086db4e602a28ae.zip
cpython-810c1769f1c24ed907bdf3cc1086db4e602a28ae.tar.gz
cpython-810c1769f1c24ed907bdf3cc1086db4e602a28ae.tar.bz2
bpo-27062: add `__all__` to inspect module (GH-30003)
-rw-r--r--Lib/inspect.py101
-rw-r--r--Lib/test/test_inspect.py3
-rw-r--r--Misc/NEWS.d/next/Library/2021-12-09-11-50-32.bpo-27062.R5vii6.rst1
3 files changed, 104 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 1eb2f2b..746f6e4 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -32,7 +32,106 @@ Here are some of the useful functions provided by this module:
__author__ = ('Ka-Ping Yee <ping@lfw.org>',
'Yury Selivanov <yselivanov@sprymix.com>')
-
+
+__all__ = [
+ "ArgInfo",
+ "Arguments",
+ "Attribute",
+ "BlockFinder",
+ "BoundArguments",
+ "CORO_CLOSED",
+ "CORO_CREATED",
+ "CORO_RUNNING",
+ "CORO_SUSPENDED",
+ "CO_ASYNC_GENERATOR",
+ "CO_COROUTINE",
+ "CO_GENERATOR",
+ "CO_ITERABLE_COROUTINE",
+ "CO_NESTED",
+ "CO_NEWLOCALS",
+ "CO_NOFREE",
+ "CO_OPTIMIZED",
+ "CO_VARARGS",
+ "CO_VARKEYWORDS",
+ "ClassFoundException",
+ "ClosureVars",
+ "EndOfBlock",
+ "FrameInfo",
+ "FullArgSpec",
+ "GEN_CLOSED",
+ "GEN_CREATED",
+ "GEN_RUNNING",
+ "GEN_SUSPENDED",
+ "Parameter",
+ "Signature",
+ "TPFLAGS_IS_ABSTRACT",
+ "Traceback",
+ "classify_class_attrs",
+ "cleandoc",
+ "currentframe",
+ "findsource",
+ "formatannotation",
+ "formatannotationrelativeto",
+ "formatargvalues",
+ "get_annotations",
+ "getabsfile",
+ "getargs",
+ "getargvalues",
+ "getattr_static",
+ "getblock",
+ "getcallargs",
+ "getclasstree",
+ "getclosurevars",
+ "getcomments",
+ "getcoroutinelocals",
+ "getcoroutinestate",
+ "getdoc",
+ "getfile",
+ "getframeinfo",
+ "getfullargspec",
+ "getgeneratorlocals",
+ "getgeneratorstate",
+ "getinnerframes",
+ "getlineno",
+ "getmembers",
+ "getmembers_static",
+ "getmodule",
+ "getmodulename",
+ "getmro",
+ "getouterframes",
+ "getsource",
+ "getsourcefile",
+ "getsourcelines",
+ "indentsize",
+ "isabstract",
+ "isasyncgen",
+ "isasyncgenfunction",
+ "isawaitable",
+ "isbuiltin",
+ "isclass",
+ "iscode",
+ "iscoroutine",
+ "iscoroutinefunction",
+ "isdatadescriptor",
+ "isframe",
+ "isfunction",
+ "isgenerator",
+ "isgeneratorfunction",
+ "isgetsetdescriptor",
+ "ismemberdescriptor",
+ "ismethod",
+ "ismethoddescriptor",
+ "ismodule",
+ "isroutine",
+ "istraceback",
+ "signature",
+ "stack",
+ "trace",
+ "unwrap",
+ "walktree",
+]
+
+
import abc
import ast
import dis
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 33665cf..c25256d 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -107,6 +107,9 @@ class IsTestBase(unittest.TestCase):
continue
self.assertFalse(other(obj), 'not %s(%s)' % (other.__name__, exp))
+ def test__all__(self):
+ support.check__all__(self, inspect, not_exported=("k", "v", "mod_dict", "modulesbyfile"))
+
def generator_function_example(self):
for i in range(2):
yield i
diff --git a/Misc/NEWS.d/next/Library/2021-12-09-11-50-32.bpo-27062.R5vii6.rst b/Misc/NEWS.d/next/Library/2021-12-09-11-50-32.bpo-27062.R5vii6.rst
new file mode 100644
index 0000000..3ca22b6
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-12-09-11-50-32.bpo-27062.R5vii6.rst
@@ -0,0 +1 @@
+Add :attr:`__all__` to :mod:`inspect`, patch by Kumar Aditya. \ No newline at end of file