# RuntimeWarning: 标量乘法时发生溢出

- **ID:** `python/numpy-overflow-uint8`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

对定宽整数 dtype（如 uint8）进行算术运算时超出其范围。NumPy 会静默回绕并发出 RuntimeWarning。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   arr = arr.astype(np.int64) before arithmetic
   ```
2. **** (85% 成功率)
   ```
   Use np.multiply(a, b, dtype=np.int64, casting='unsafe')
   ```

## 无效尝试

- **** — Silences warning but overflow still wraps to wrong values (95% 失败率)
- **** — Raises FloatingPointError but doesn't fix the underlying dtype (80% 失败率)
