Skip to content

Commit 0401eb5

Browse files
docs(limit and errors): Allign docs and clean redaction.
1 parent 7ab675b commit 0401eb5

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

docs/pages/reference/limits-and-errors.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: "Sandbox limits, error types, and runtime guarantees."
55

66
## Sandbox limits
77

8-
Two profiles via `VM::with_limits`, same `compiler.wasm` runs unsandboxed in trusted contexts, clamped in untrusted.
8+
Two profiles via `VM::with_limits`: the same `compiler.wasm` runs unsandboxed in trusted contexts, clamped in untrusted.
99

1010
| Limit | `none()` (default) | `sandbox()` | What hitting it raises |
1111
|----------------|--------------------|---------------|------------------------|
@@ -20,7 +20,7 @@ Two-tier:
2020
* **Inline (fast)**: 47-bit signed in a NaN-boxed `Val`. Range `+/-2^47` (`+/-140_737_488_355_327`). One ALU op per arithmetic, no allocation.
2121
* **Wide (slow)**: i128 in `HeapObj::LongInt`. Range `+/-2^127 - 1`. Auto-used when a literal exceeds 47-bit or inline arithmetic overflows.
2222

23-
Outside `+/-2^127` raises `OverflowError`. Promotion is automatic, user code doesn't see the boundary.
23+
Outside `+/-2^127` raises `OverflowError`. Promotion is automatic; user code doesn't see the boundary.
2424

2525
```python
2626
print(140737488355327) # inline, fast path
@@ -43,14 +43,14 @@ overflow
4343

4444
- **`pow(a, b, m)` modular**: modulus must be `< 2^63` (larger overflows i128 in the multiply). Hard cap without arbitrary-precision arithmetic.
4545
- **No CPython-style unbounded ints**: by design, edge workloads don't need wider than 128 bits; crypto-scale math is out of scope.
46-
- **Float vs LongInt mixing**: `==` works (LongInt -> f64), but dict/set hashing follows raw `Val` bits, `{long_int: x}` indexed by a same-magnitude float misses. Coerce explicitly.
46+
- **Float vs LongInt mixing**: `==` works (LongInt -> f64), but dict/set hashing follows raw `Val` bits `{long_int: x}` indexed by a same-magnitude float misses. Coerce explicitly.
4747

4848
### Triggering limits
4949

5050
```python
5151
# Recursion depth
5252
def loop(n):
53-
return loop(n + 1)
53+
return loop(n + 1)
5454

5555
try:
5656
loop(0)
@@ -85,7 +85,7 @@ Source must be under 10 MiB; larger rejected at lex time.
8585
| Max expression depth | 200 |
8686
| Max instructions per chunk | 65,535 |
8787

88-
Prevent asymmetric DoS, small input producing an exponentially large parse tree.
88+
Prevent asymmetric DoS: small input producing an exponentially large parse tree.
8989

9090
## Error types
9191

@@ -138,7 +138,7 @@ Raised as `VmErr`; most catchable with `try` / `except`.
138138

139139
#### Exception hierarchy
140140

141-
Flat tree rooted at `BaseException -> Exception`. `except` walks parent links, `except Exception` catches `RuntimeError`, `ValueError`, `KeyError`, `AssertionError`, etc.; `except RuntimeError` catches `RecursionError`, `NotImplementedError`. `SystemExit` sits directly under `BaseException`, so `except Exception` does not catch it (use `except SystemExit` or a bare `except`).
141+
Flat tree rooted at `BaseException -> Exception`. `except` walks parent links `except Exception` catches `RuntimeError`, `ValueError`, `KeyError`, `AssertionError`, etc.; `except RuntimeError` catches `RecursionError`, `NotImplementedError`. `SystemExit` sits directly under `BaseException`, so `except Exception` does not catch it (use `except SystemExit` or a bare `except`).
142142

143143
```python
144144
try:
@@ -157,7 +157,7 @@ caught via parent: oops
157157
caught IndexError as Exception
158158
```
159159

160-
User-defined classes don't auto-extend the built-in `BaseException` tree but support single-level inheritance among themselves, `except UserBase` catches a raised `UserSub` when `UserSub` inherits from `UserBase`. `raise X from Y` raises `X`; the cause is discarded (no `__cause__` / `__context__` chaining).
160+
User-defined classes don't auto-extend the built-in `BaseException` tree but support single-level inheritance among themselves: `except UserBase` catches a raised `UserSub` when `UserSub` inherits from `UserBase`. `raise X from Y` raises `X`; the cause is discarded (no `__cause__` / `__context__` chaining).
161161

162162
### Exception arguments
163163

@@ -214,7 +214,7 @@ type
214214

215215
### Environmental errors
216216

217-
Failures surfaced before the source reaches the compiler, no line/column preview, no parsed code to anchor to. Emitted as plain text, uncatchable from Python.
217+
Failures surfaced before the source reaches the compiler: no line/column preview, no parsed code to anchor to. Emitted as plain text, uncatchable from Python.
218218

219219
| Error | When | Resolution |
220220
|---------------------------------------------|-----------------------------------------------|---------------------------------------|
@@ -238,4 +238,4 @@ Exist for syntactic compatibility. For code reuse, use higher-order functions.
238238

239239
## Determinism
240240

241-
Same source + input -> same output across runs and architectures (`x86_64`, `aarch64`, `wasm32`). No time, randomness, threading, or OS interaction. Heap-pool slot reuse is the only nondeterminism, observable through `id(x)` only, never `==`, `repr`, or any other operation.
241+
Same source + input -> same output across runs and architectures (`x86_64`, `aarch64`, `wasm32`). No time, randomness, threading, or OS interaction. Heap-pool slot reuse is the only nondeterminism: observable through `id(x)` only, never `==`, `repr`, or any other operation.

0 commit comments

Comments
 (0)