mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
bpo-44530: Add co_qualname field to PyCodeObject (GH-26941)
This commit is contained in:
parent
32096df0e0
commit
2f180ce2cb
20 changed files with 7457 additions and 7444 deletions
|
@ -17,7 +17,7 @@ cellvars: ('x',)
|
|||
freevars: ()
|
||||
nlocals: 2
|
||||
flags: 3
|
||||
consts: ('None', '<code object g>', "'f.<locals>.g'")
|
||||
consts: ('None', '<code object g>')
|
||||
|
||||
>>> dump(f(4).__code__)
|
||||
name: g
|
||||
|
@ -223,6 +223,7 @@ class CodeTest(unittest.TestCase):
|
|||
co.co_varnames,
|
||||
co.co_filename,
|
||||
co.co_name,
|
||||
co.co_qualname,
|
||||
co.co_firstlineno,
|
||||
co.co_lnotab,
|
||||
co.co_endlinetable,
|
||||
|
@ -231,6 +232,12 @@ class CodeTest(unittest.TestCase):
|
|||
co.co_freevars,
|
||||
co.co_cellvars)
|
||||
|
||||
def test_qualname(self):
|
||||
self.assertEqual(
|
||||
CodeTest.test_qualname.__code__.co_qualname,
|
||||
CodeTest.test_qualname.__qualname__
|
||||
)
|
||||
|
||||
def test_replace(self):
|
||||
def func():
|
||||
x = 1
|
||||
|
@ -297,6 +304,7 @@ class CodeTest(unittest.TestCase):
|
|||
co.co_varnames,
|
||||
co.co_filename,
|
||||
co.co_name,
|
||||
co.co_qualname,
|
||||
co.co_firstlineno,
|
||||
co.co_lnotab,
|
||||
co.co_endlinetable,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue