summaryrefslogtreecommitdiff
path: root/Lib/test/test_funcattrs.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-02-18 12:35:37 +0100
committerGitHub <noreply@github.com>2021-02-18 12:35:37 +0100
commita3c3ffa68e6fc4524b1149a6a14d56c3a2e9b612 (patch)
tree3dd6f26b5a5fe9b3e2d3bcb0f465bfd28d5bb6b1 /Lib/test/test_funcattrs.py
parent366dc3a1354078e38808b9c16276e97cca5b8aaf (diff)
downloadcpython-git-a3c3ffa68e6fc4524b1149a6a14d56c3a2e9b612.tar.gz
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.
Diffstat (limited to 'Lib/test/test_funcattrs.py')
-rw-r--r--Lib/test/test_funcattrs.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py
index 11d68cc75e..15cf250f19 100644
--- a/Lib/test/test_funcattrs.py
+++ b/Lib/test/test_funcattrs.py
@@ -73,6 +73,11 @@ class FunctionPropertiesTest(FuncAttrsTest):
self.cannot_set_attr(self.b, '__globals__', 2,
(AttributeError, TypeError))
+ def test___builtins__(self):
+ self.assertIs(self.b.__builtins__, __builtins__)
+ self.cannot_set_attr(self.b, '__builtins__', 2,
+ (AttributeError, TypeError))
+
def test___closure__(self):
a = 12
def f(): print(a)