bpo-42990: Add __builtins__ attribute to functions (GH-24559)
Expose the new PyFunctionObject.func_builtins member in Python as a
new __builtins__ attribute on functions.
Document also the behavior change in What's New in Python 3.10.
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 850d601..1033964 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -95,6 +95,8 @@
| | __globals__ | global namespace in which |
| | | this function was defined |
+-----------+-------------------+---------------------------+
+| | __builtins__ | builtins namespace |
++-----------+-------------------+---------------------------+
| | __annotations__ | mapping of parameters |
| | | names to annotations; |
| | | ``"return"`` key is |
@@ -251,6 +253,10 @@
Add ``cr_origin`` attribute to coroutines.
+.. versionchanged:: 3.10
+
+ Add ``__builtins__`` attribute to functions.
+
.. function:: getmembers(object[, predicate])
Return all the members of an object in a list of ``(name, value)``