Skip to content

Commit 6cc0684

Browse files
YangSiJun528youknowone
authored andcommitted
Return distinct empty lists from select() (#8720)
Assisted-by: Codex:gpt-6-astra (cherry picked from commit 3bdd2f9)
1 parent f569444 commit 6cc0684

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎Lib/test/test_select.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def test_errno(self):
4040
else:
4141
self.fail("exception not raised")
4242

43-
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: unexpectedly identical: []
4443
def test_returned_list_identity(self):
4544
# See issue #8329
4645
r, w, x = select.select([], [], [], 1)

‎crates/stdlib/src/select.rs‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,11 @@ mod decl {
117117
let (xlist, mut x) = seq2set(&xlist)?;
118118

119119
if rlist.is_empty() && wlist.is_empty() && xlist.is_empty() {
120-
let empty = vm.ctx.new_list(vec![]);
121-
return Ok((empty.clone(), empty.clone(), empty));
120+
return Ok((
121+
vm.ctx.new_list(vec![]),
122+
vm.ctx.new_list(vec![]),
123+
vm.ctx.new_list(vec![]),
124+
));
122125
}
123126

124127
let nfds = cfg_select! {

0 commit comments

Comments
 (0)