Skip to content

Commit 66cc666

Browse files
authored
Merge branch 'main' into winapi
2 parents 42255d8 + 2c417d5 commit 66cc666

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Lib/test/test_ast/test_ast.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2663,7 +2663,6 @@ def test_validation(self):
26632663
self.assertEqual(str(cm.exception),
26642664
"got an invalid type in Constant: list")
26652665

2666-
@unittest.expectedFailure # TODO: RUSTPYTHON; b'' is not b''
26672666
def test_singletons(self):
26682667
for const in (None, False, True, Ellipsis, b''):
26692668
with self.subTest(const=const):

crates/vm/src/vm/context.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,11 @@ impl Context {
455455

456456
#[inline]
457457
pub fn new_bytes(&self, data: Vec<u8>) -> PyRef<PyBytes> {
458-
PyBytes::from(data).into_ref(self)
458+
if data.is_empty() {
459+
self.empty_bytes.clone()
460+
} else {
461+
PyBytes::from(data).into_ref(self)
462+
}
459463
}
460464

461465
#[inline]

0 commit comments

Comments
 (0)