# TypeError: NoneType 对象不能用于 'await' 表达式

- **ID:** `python/fastapi-await-none-coroutine`
- **领域:** python
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

异步路由 await 了一个实际上是同步的调用（例如同步数据库驱动或返回 None 的函数）。

## 版本兼容性

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

## 解决方案

1. **** (88% 成功率)
   ```
   Use an async driver or run sync in a threadpool:
from starlette.concurrency import run_in_threadpool
result = await run_in_threadpool(sync_fn)
   ```
2. **** (90% 成功率)
   ```
   Remove await when calling a synchronous function.
   ```

## 无效尝试

- **** — Fixes this call but blocks the event loop for other requests. (60% 失败率)
- **** — Doesn't make the awaited object awaitable. (85% 失败率)
