fix: make awkward compatible with numexpr 2.11#3533
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds compatibility for NumExpr 2.11 by introducing version‐dependent cache initialization and routing through new .l and .c attributes.
- Add a
parse_versioncheck for NumExpr ≥2.11 to create per‐version sub‐caches onnecompilerinternals. - Route all lookups through
_numexpr_last,_names_cache, and_numexpr_cachelocals. - Mirror the same branching logic in both
evaluateandre_evaluate.
Comments suppressed due to low confidence (3)
src/awkward/_connect/numexpr.py:81
- [nitpick] Using single‐letter attribute names like
.land.cis cryptic. Consider using more descriptive names or adding comments to clarify their purpose.
if not hasattr(numexpr.necompiler._numexpr_last, "l"):
src/awkward/_connect/numexpr.py:80
- [nitpick] Add dedicated tests for the NumExpr ≥2.11.0 code paths to ensure new cache attributes (
.l,.c) behave correctly and to prevent regressions.
if parse_version(numexpr.__version__) >= parse_version("2.11.0"):
src/awkward/_connect/numexpr.py:167
- The error message reads awkwardly. Consider changing it to: "No previous evaluate() execution found." for clearer grammar.
"not a previous evaluate() execution found"
|
@ianna @pfackeldey I'm not particularly familiar with numexpr so this is just my first attempt. Do your thing if you have better ideas. This "works" though although I don't know if I'm missing something with numexpr's free-threading support in version 2.11 |
|
Oh and here the ci fails because of the problems #3531 is fixing haha |
|
@ikrommyd I'd rather have someone else than me have a look at this. I'm not at all familiar with numexpr. |
Yeah I tried to mimic how numexpr implements their own evaluate function by reading their code. I don't know anything more than you I'm afraid. |
|
The only test affected by this PR is |
|
For reference, it seems to work fine on free-threaded python. |
Co-authored-by: Henry Schreiner <henry.fredrick.schreiner@cern.ch>
Well I did the first suggestion which was to cache the |

No description provided.