Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-115859: Re-enable T2 optimizer pass by default #116062

Merged
merged 9 commits into from
Feb 28, 2024
Prev Previous commit
Next Next commit
Add a test that crashed before #116028
  • Loading branch information
gvanrossum committed Feb 28, 2024
commit b834b299b3775dbc1856dd4c87e35588d542ab62
15 changes: 15 additions & 0 deletions Lib/test/test_capi/test_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,5 +890,20 @@ def testfunc(n):
self.assertLessEqual(len(guard_both_float_count), 1)
self.assertIn("_COMPARE_OP_STR", uops)

def test_type_inconsistency(self):
def testfunc(n):
for i in range(n):
x = _test_global + _test_global
# Must be a real global else it won't be optimized to _LOAD_CONST_INLINE
global _test_global
_test_global = 0
_, ex = self._run_with_optimizer(testfunc, 16)
self.assertIsNone(ex)
_test_global = 1.2
_, ex = self._run_with_optimizer(testfunc, 16)
self.assertIsNotNone(ex)
self.assertIn("_BINARY_OP_ADD_INT", get_opnames(ex))


if __name__ == "__main__":
unittest.main()