| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…HECK_IS_NOT_PY_CALLABLE_EX`
That's not really a problem, just how the JIT behaves. We only compile the region inside the for loop first, and then a function only if it's hot enough. As for the code example above you placed the sorted outside the for loop, the JIT has no visibility of it. |
Sorry, something went wrong.
|
oh I understand, thank you! |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. Thank you.
Sorry, something went wrong.
…HECK_IS_NOT_PY_CALLABLE_KW` (pythonGH-148494)
| Back | FazBrowse Home | New Git URL |
While implementing this, I ran into a confusing problem. As shown in the diff below, when I assign f = sorted instead of calling sorted() directly, the JIT fails to recognize the optimization, causing the test to fail.
def test_check_is_not_py_callable_kw(self): def testfunc(n): total = 0 - xs = (3, 1, 2) - for _ in range(n): - total += sorted(xs, reverse=False)[0] + f = sorted + xs = (3, 1, 2) + for _ in range(n): + total += f(xs, reverse=False)[0] return total res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD) self.assertEqual(res, TIER2_THRESHOLD) self.assertIsNotNone(ex) uops = get_opnames(ex) self.assertNotIn("_CHECK_IS_NOT_PY_CALLABLE_KW", uops)Edit: Please add skip news