mirror of
https://github.com/octocat/Hello-World.git
synced 2026-07-01 15:27:50 +00:00
Add safe expression evaluator (calc/engine/evaluator.py + builtins.py)
- evaluator.evaluate(expr, extra_names) returns (result_str, is_error) - blocks __builtins__ to prevent arbitrary code execution - handles ZeroDivisionError, ValueError, NameError with friendly messages - builtins.SAFE_NAMES covers trig, hyperbolic, log, exp, rounding, constants
This commit is contained in:
parent
7fd1a60b01
commit
bde60ad530
4 changed files with 48 additions and 0 deletions
0
calc/engine/__init__.py
Normal file
0
calc/engine/__init__.py
Normal file
Loading…
Add table
Add a link
Reference in a new issue