summaryrefslogtreecommitdiff
path: root/Lib/test/test_code.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2021-06-23 09:51:44 -0700
committerGitHub <noreply@github.com>2021-06-23 09:51:44 -0700
commit769d7d0c66c5b86e2dd29b9ce67ac2daaab1bb38 (patch)
tree48ceed799fea9009441a6eb71c97cdee08e16eb5 /Lib/test/test_code.py
parent34356a0a4bad0be124ae892cda6c30a38f5f1061 (diff)
downloadcpython-git-769d7d0c66c5b86e2dd29b9ce67ac2daaab1bb38.tar.gz
bpo-43693 Get rid of CO_NOFREE -- it's unused (GH-26839)
All uses of this flag are either setting it or in doc or tests for it. So we should be able to get rid of it completely.
Diffstat (limited to 'Lib/test/test_code.py')
-rw-r--r--Lib/test/test_code.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py
index 244acab560..27342ad414 100644
--- a/Lib/test/test_code.py
+++ b/Lib/test/test_code.py
@@ -49,7 +49,7 @@ varnames: ('x', 'y', 'a', 'b', 'c')
cellvars: ()
freevars: ()
nlocals: 5
-flags: 67
+flags: 3
consts: ('None',)
>>> def attrs(obj):
@@ -67,7 +67,7 @@ varnames: ('obj',)
cellvars: ()
freevars: ()
nlocals: 1
-flags: 67
+flags: 3
consts: ('None',)
>>> def optimize_away():
@@ -86,7 +86,7 @@ varnames: ()
cellvars: ()
freevars: ()
nlocals: 0
-flags: 67
+flags: 3
consts: ("'doc string'", 'None')
>>> def keywordonly_args(a,b,*,k1):
@@ -103,7 +103,7 @@ varnames: ('a', 'b', 'k1')
cellvars: ()
freevars: ()
nlocals: 3
-flags: 67
+flags: 3
consts: ('None',)
>>> def posonly_args(a,b,/,c):
@@ -120,7 +120,7 @@ varnames: ('a', 'b', 'c')
cellvars: ()
freevars: ()
nlocals: 3
-flags: 67
+flags: 3
consts: ('None',)
"""
@@ -199,10 +199,6 @@ class CodeTest(unittest.TestCase):
class_ref = function.__closure__[0].cell_contents
self.assertIs(class_ref, List)
- # Ensure the code correctly indicates it accesses a free variable
- self.assertFalse(function.__code__.co_flags & inspect.CO_NOFREE,
- hex(function.__code__.co_flags))
-
# Ensure the zero-arg super() call in the injected method works
obj = List([1, 2, 3])
self.assertEqual(obj[0], "Foreign getitem: 1")