diff options
author | Mark Shannon <mark@hotpy.org> | 2023-07-04 16:23:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-04 16:23:00 (GMT) |
commit | 318ea2c72e9aed7ac92457c28747eda9424c8327 (patch) | |
tree | 76e36a8bfdc7a6702b4fa5f4c7c34944efafc6d6 /Lib | |
parent | 80f1c6c49b4cd2bf698eb2bc3d2f3da904880dd2 (diff) | |
download | cpython-318ea2c72e9aed7ac92457c28747eda9424c8327.zip cpython-318ea2c72e9aed7ac92457c28747eda9424c8327.tar.gz cpython-318ea2c72e9aed7ac92457c28747eda9424c8327.tar.bz2 |
GH-106360: Support very basic superblock introspection (#106422)
* Add len() and indexing support to uop superblocks.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_capi/test_misc.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_capi/test_misc.py b/Lib/test/test_capi/test_misc.py index 9e825a3..de9f00a 100644 --- a/Lib/test/test_capi/test_misc.py +++ b/Lib/test/test_capi/test_misc.py @@ -2415,5 +2415,28 @@ class TestOptimizerAPI(unittest.TestCase): self.assertEqual(opt.get_count(), 10) +class TestUops(unittest.TestCase): + + def test_basic_loop(self): + + def testfunc(x): + i = 0 + while i < x: + i += 1 + + testfunc(1000) + + ex = None + for offset in range(0, 100, 2): + try: + ex = _testinternalcapi.get_executor(testfunc.__code__, offset) + break + except ValueError: + pass + if ex is None: + return + self.assertIn("SAVE_IP", str(ex)) + + if __name__ == "__main__": unittest.main() |