565 Commits

Author SHA1 Message Date
mengw f84a6ca145 update document 2026-07-27 21:34:50 +02:00
mengw 0577f26eb5 Harden expression sanitization with AST validation
Replace regex-based expression filtering with an AST allowlist and evaluate sanitized expressions without Python builtins.

Resolve sanitize=None consistently across all compilation and evaluation paths, including disable_cache and direct NumExpr usage.

Preserve supported syntax and compatibility for conditional expressions, identity and membership comparisons, and variable names containing double underscores. Retain native SyntaxError behavior for parser failures and TypeError for unknown functions.

Add regression tests and release notes for the sanitizer changes.
2026-07-27 16:53:55 +02:00
Francesc Alted d48823ae9b Fix constsig leak on itemsizes allocation failure in NumExpr_init. Closes #561. 2026-07-18 12:13:01 +02:00
Francesc Alted 371d064b65 Merge branch 'master' of github.com:pydata/numexpr 2026-07-18 12:08:48 +02:00
Francesc Alted 2059974b3d Return the actual result code from run_interpreter()
run_interpreter() computed the execution engine's result code but
unconditionally returned 0, discarding it. The caller checks for a
negative return to raise an exception, so any failure in the serial
or parallel VM engine was silently swallowed and whatever was left
in the (possibly unwritten) output buffer was returned instead.

Possibly related to pydata/numexpr#557, though the exact trigger for
that issue's intermittent all-zero output on Windows is not
confirmed.
2026-07-18 12:08:06 +02:00
uwezkhan caa29dcf8d Guard out-of-range shift counts in integer opcodes 2026-07-08 15:54:02 +05:30
Francesc Alted 2288788804 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-24 10:47:01 +02:00
Vincent Gao a6ad5431c2 Avoid retaining evaluate out arrays 2026-06-19 02:25:44 +02:00
Francesc Alted 1e3241d988 Print versions during tests execution 2025-12-02 12:52:05 +01:00
27rabbitlt c657605cd1 FIX: comment out refcount since Python optimizes refcounts. Keep the test for future reference purpose 2025-11-07 19:25:41 +01:00
pre-commit-ci[bot] 20f31d46fd [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-11-07 16:05:26 +00:00
27rabbitlt d1aa68b1a7 FEAT: add disable_cache parameter in evaluate function. When set to True, we disable the internal cache mechenism nad evaluate the expression directly 2025-11-07 17:03:11 +01:00
lshaw8317 898b4d9dbf Update tests to pass for numpy 1.26 2025-10-13 16:12:48 +02:00
lshaw8317 eb2f999703 Revert "Merge pull request #534 from jorenham/static-typing"
This reverts commit bce38b4317, reversing
changes made to cd730c826f.
2025-10-13 15:49:53 +02:00
Joren Hammudoglu 8ba43afd74 Merge branch 'master' into static-typing 2025-10-02 16:12:39 +02:00
Francesc Alted cd730c826f Merge pull request #537 from pydata/fix_tan
Fix numerical stability for tan/tanh
2025-10-01 10:40:23 +02:00
Luke Shaw 780908af3d Make test stricter 2025-09-30 15:33:23 +02:00
Luke Shaw 74149e7104 Fix numerical stability for tan/tanh 2025-09-30 15:27:24 +02:00
Luke Shaw f1487d4dc5 Fix boolean add/mult 2025-09-30 14:43:12 +02:00
Luke Shaw f114e9f49f Add nan handling to maximum/minimum 2025-09-30 12:15:01 +02:00
jorenham 36ca8d1f16 revert problematic functional changes in setOrderedRegisterNumbers 2025-09-25 19:33:59 +02:00
jorenham 17c206a113 stringify remaining problematic annotations 2025-09-25 00:46:10 +02:00
jorenham d8161ba2ea add missing annotation quotes 2025-09-25 00:31:37 +02:00
jorenham 895df61a96 add the py.typed 2025-09-24 23:55:58 +02:00
jorenham 49bc1816e3 run isort 2025-09-24 23:43:03 +02:00
jorenham 910a31c0b5 fix typing errors in the tests 2025-09-24 23:33:16 +02:00
jorenham ba6dc39a4d annotate necompiler 2025-09-24 21:44:24 +02:00
jorenham ea2c17bc8b annotate interpreter.NumExpr 2025-09-24 21:44:11 +02:00
jorenham 35800698ba annotate expressions 2025-09-24 19:52:15 +02:00
jorenham a761d4e51f annotate __init__.py 2025-09-24 17:25:17 +02:00
jorenham 121f2b0dc8 annotate cpuinfo 2025-09-24 17:24:27 +02:00
jorenham 65ad97ecb1 annotate utils 2025-09-24 16:53:36 +02:00
jorenham 34c8486b6c typing stubs for version and interpreter 2025-09-24 15:22:56 +02:00
Luke Shaw 2359726291 Add TODO 2025-09-24 13:13:30 +02:00
Luke Shaw 9c1d5981ac Fix test 2025-09-24 13:10:46 +02:00
Luke Shaw e7aac75f03 Fix fmod bug 2025-09-24 12:46:13 +02:00
Luke Shaw c9775f2dde Improve casting for ints to match Numpy and add docs 2025-09-24 11:07:43 +02:00
Luke Shaw 4eab0e0c0a Fix test 2025-09-23 15:50:56 +02:00
Luke Shaw 544c8d017c Fix test for stricter Windows 2025-09-23 15:41:41 +02:00
Luke Shaw 3538e4adad Handle overloading of fmax/fmin 2025-09-23 14:58:17 +02:00
Luke Shaw 7e1585bdfb Fix typo with maxf/minf funcs for Windows 2025-09-23 14:29:20 +02:00
Luke Shaw 2c6b79627c Delay definition of signf2 2025-09-23 13:14:49 +02:00
Luke Shaw fbe2dcf016 Reorder imports for Windows 2025-09-23 13:08:30 +02:00
Luke Shaw 38907d7475 Add sign, maximum, minimum 2025-09-23 13:00:28 +02:00
Luke Shaw 03ead57ded Correct output type of signbitf 2025-09-23 08:48:48 +02:00
Luke Shaw 996d56fd81 Added copysign, signbit 2025-09-22 21:42:06 +02:00
Luke Shaw 616806a539 Added trunc, round, nextafter 2025-09-22 20:58:40 +02:00
Luke Shaw 07b54adfa8 Add hypot 2025-09-22 20:01:25 +02:00
Luke Shaw d02cc8d370 Added floor division and log2 2025-09-22 17:17:10 +02:00
Luke Shaw a39c806f97 Add (true) bitwise ops, bitwise and logical xor 2025-09-22 12:58:13 +02:00