mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
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.
This commit is contained in:
parent
366dc3a135
commit
a3c3ffa68e
6 changed files with 24 additions and 3 deletions
|
|
@ -682,9 +682,10 @@ class TestNamedTuple(unittest.TestCase):
|
|||
self.assertEqual(np.y, 2)
|
||||
|
||||
def test_new_builtins_issue_43102(self):
|
||||
self.assertEqual(
|
||||
namedtuple('C', ()).__new__.__globals__['__builtins__'],
|
||||
{})
|
||||
obj = namedtuple('C', ())
|
||||
new_func = obj.__new__
|
||||
self.assertEqual(new_func.__globals__['__builtins__'], {})
|
||||
self.assertEqual(new_func.__builtins__, {})
|
||||
|
||||
|
||||
################################################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue