gh-91248: Optimize PyFrame_GetVar() (#99252)

PyFrame_GetVar() no longer creates a temporary dictionary to get a
variable.
This commit is contained in:
Victor Stinner 2022-11-13 15:37:03 +01:00 committed by GitHub
parent 57be545959
commit 6788303f5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 146 additions and 97 deletions

View file

@ -352,6 +352,12 @@ class TestCAPI(unittest.TestCase):
with self.assertRaises(NameError):
_testcapi.frame_getvarstring(current_frame, b"y")
# wrong name type
with self.assertRaises(TypeError):
_testcapi.frame_getvar(current_frame, b'x')
with self.assertRaises(TypeError):
_testcapi.frame_getvar(current_frame, 123)
def getgenframe(self):
yield sys._getframe()