Skip to content

Commit 9968db0

Browse files
authored
Release PickleBuffer outside its lock (#9587)
Detach the buffer under the lock and drop it afterward so a final-share Python release callback can reenter without deadlocking. Assisted-by: OpenAI Codex:model version not exposed
1 parent c8991a5 commit 9968db0

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎crates/stdlib/src/pickle.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ mod _pickle {
115115

116116
#[pymethod]
117117
fn release(zelf: &Py<Self>) {
118-
*zelf.buffer.write() = None;
118+
// Releasing the last share can invoke Python's __release_buffer__.
119+
// Publish the released state and drop the lock before that callback.
120+
let buffer = zelf.buffer.write().take();
121+
drop(buffer);
119122
}
120123
}
121124

0 commit comments

Comments
 (0)