gh-101865: Deprecate co_lnotab from code objects as per PEP 626 (#101866)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
This commit is contained in:
Nikita Sobolev 2023-04-03 18:35:04 +03:00 committed by GitHub
parent e6f7d35be7
commit 2a721258a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 1 deletions

View file

@ -338,6 +338,13 @@ class CodeTest(unittest.TestCase):
new_code = code = func.__code__.replace(co_linetable=b'')
self.assertEqual(list(new_code.co_lines()), [])
def test_co_lnotab_is_deprecated(self): # TODO: remove in 3.14
def func():
pass
with self.assertWarns(DeprecationWarning):
func.__code__.co_lnotab
def test_invalid_bytecode(self):
def foo():
pass