Repository navigation
Test NumPy's result dtypes on the typed evaluator (follow-up to #754) - #758
Merged
FrancescAlted merged 1 commit intoNov 5, 2026
Merged
Conversation
The dtype tests of Blosc#754, on the typed evaluator: float functions and true division of integer and bool subexpressions, bool //, % and **, non-native byte order, and arctan2() rejecting complex operands. The values of expr[:] are checked too. The WebAssembly xfails are gone; the cases the legacy evaluator still gets wrong are strict xfails there. New strict xfail: comparing an int8 array with 300 raises OverflowError in the typed evaluator, while NumPy 2 compares (all True). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
|
Thanks @FabianIsensee for this! Merged into The combined stack passed the full test suite (12,841 passed on the default path, 12,765 on legacy) and the Menudet paired qualification, including the exact-pair wheel and tcc JIT tests (run 41998579498). Thanks again! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Francesc,
this follows up #754, as you asked there. Your typed evaluator supersedes #754's source change, so this PR only brings over its tests, adapted to
improved-miniexprat 7eae862, plus one strict xfail for a bug I found on the way.What it adds (all in
tests/ndarray/test_lazyexpr.py):test_lazyexpr_result_dtype_matches_numpy: 17 expressions (float functions and true division of integer and bool subexpressions, bool//,%and**, ...) × bool/int8/uint16/int32/int64 × built from functions or from a string. It checks the dtype ofexpr[:],expr[...],compute()andexpr[:7], and the values ofexpr[:],compute()andexpr[:7]against NumPy. Give lazy expressions NumPy's result dtype for division and float functions #754 did not check the values ofexpr[:], which the bundled miniexpr computed wrongly there.test_lazyexpr_non_native_byte_orderandtest_arctan2_rejects_complex_when_built, as in Give lazy expressions NumPy's result dtype for division and float functions #754.test_comparison_with_out_of_range_python_int, a strict xfail (see below).WebAssembly: #754 marked 30 cases as strict xfails on WASM, because there the bundled miniexpr computed them. With the typed evaluator they pass, also with
blosc2.IS_WASM = Trueset natively, so this PR has no WASM xfails. The WASM CI job checks it on a real Pyodide build.Legacy evaluator: with
BLOSC2_EXPRESSION_EVALUATOR=legacy, 80 cases still fail: 64 give the uniform evaluator's result dtype, and 16 compute integer true division in integer arithmetic onexpr[:]. They are strict xfails in legacy mode only (_LEGACY_RESULT_DTYPE_FAILURES), so the list can go when the legacy evaluator does.Bug in the typed evaluator (strict xfail):
blosc2.lazyexpr("a < 300", {"a": a})with an int8araisesOverflowError: Python integer 300 out of bounds for int8on[:],compute()and.sum(), and so doesa < 300. NumPy 2 compares (all True); only arithmetic with such an int raises. The error comes fromexpression_graph._numpy_binary_dtype(), called throughnative_weak_scalars_eligible(), which treats the comparison like arithmetic. The legacy evaluator casts 300 to int8 (44) instead: 144 True of 200 on[:]andcompute(); its.sum()is right.Not a bug, so not included: the float16 sums of
hypot()/arctan2()of bool arrays that I had flagged match NumPy's own float16 sums to one float16 ulp (hypot: 3324 vs NumPy 3322;arctan2: equal). My earlier reproducer compared them with a float64 sum.Tests (NumPy 2.5.4, Linux x86-64, bundled miniexpr 687e02b and c-blosc2 3.5.0):
blosc2.IS_WASM = True.tests/ndarray/test_lazyexpr.py: typed 1053 passed, 15 skipped, 3 xfailed; legacy 974 passed, 15 skipped, 82 xfailed.b2viewhttp tests that need aiohttp.AI disclosure: the port, the new test and the checks were done with Claude Code; I reviewed them.
Best,
Fabian
🤖 Generated with Claude Code