GH-100117: Make co_lines more efficient (GH-100447)

This commit is contained in:
Brandt Bucher 2023-01-10 02:56:53 -08:00 committed by GitHub
parent b2f7b2ef0b
commit f07daaf4f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 38 deletions

View file

@ -702,7 +702,8 @@ class CodeLocationTest(unittest.TestCase):
def check_lines(self, func):
co = func.__code__
lines1 = list(dedup(l for (_, _, l) in co.co_lines()))
lines1 = [line for _, _, line in co.co_lines()]
self.assertEqual(lines1, list(dedup(lines1)))
lines2 = list(lines_from_postions(positions_from_location_table(co)))
for l1, l2 in zip(lines1, lines2):
self.assertEqual(l1, l2)