Skip to content

Commit a809746

Browse files
committed
Improve frozenset debug representation
For `frozenset([1, 2, "str"])` object, it is represented as `frozenset { [PyObject PyInt { value: 1 }], [PyObject PyInt { value: 2 }], [PyObject PyStr { value: "str", kind: Ascii, hash: -845154580267954013 }], }`
1 parent ddc801e commit a809746

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

vm/src/builtins/set.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ impl fmt::Debug for PySet {
6666
impl fmt::Debug for PyFrozenSet {
6767
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
6868
// TODO: implement more detailed, non-recursive Debug formatter
69-
f.write_str("frozenset")
69+
f.write_str("PyFrozenSet ")?;
70+
f.debug_set().entries(self.elements().iter()).finish()
7071
}
7172
}
7273

0 commit comments

Comments
 (0)