Skip to content
This repository was archived by the owner on Oct 21, 2023. It is now read-only.

Commit 1f4cfcb

Browse files
fix: async context
1 parent c66f5d6 commit 1f4cfcb

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

news/+async-context.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
修复了调用 `put` 回调时 Python 异步上下文丢失的问题。

src/login/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ fn parse_login_args<'py>(
199199
store: &'py PyAny,
200200
queues: &'py PyList,
201201
) -> PyResult<(Version, PyHandler, Device, TokenRW, TaskLocals)> {
202-
let task_locals = TaskLocals::with_running_loop(py)?; // Necessary since retrieving task locals at handling time is already insufficient
202+
let task_locals = TaskLocals::with_running_loop(py)?.copy_context(py)?; // Necessary since retrieving task locals at handling time is already insufficient
203203
let handler = PyHandler::new(queues.into_py(py), task_locals.clone(), uin);
204204

205205
let get_token = partial(py).call1((store.getattr("get_token")?, uin, &protocol))?;

0 commit comments

Comments
 (0)