[Python-checkins] bpo-27062: add `__all__` to inspect module (GH-30003)
ambv
webhook-mailer at python.org
Fri Dec 10 18:05:31 EST 2021
https://github.com/python/cpython/commit/810c1769f1c24ed907bdf3cc1086db4e602a28ae
commit: 810c1769f1c24ed907bdf3cc1086db4e602a28ae
branch: main
author: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2021-12-11T00:05:23+01:00
summary:
bpo-27062: add `__all__` to inspect module (GH-30003)
files:
A Misc/NEWS.d/next/Library/2021-12-09-11-50-32.bpo-27062.R5vii6.rst
M Lib/inspect.py
M Lib/test/test_inspect.py
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 1eb2f2b575ef4..746f6e4f9f9f0 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -32,7 +32,106 @@
__author__ = ('Ka-Ping Yee <ping at lfw.org>',
'Yury Selivanov <yselivanov at 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 33665cf3c79eb..c25256dfa26fd 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -107,6 +107,9 @@ def istest(self, predicate, exp):
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 0000000000000..3ca22b69d456f
--- /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
More information about the Python-checkins
mailing list