Skip to content

Commit 818688d

Browse files
authored
Merge pull request #2992 from moreal/bugfix/correct-object-repr
Correct `object.__repr__` format
2 parents f92996c + cda1924 commit 818688d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Lib/test/test_reprlib.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,6 @@ class bar:
318318
# Module name may be prefixed with "test.", depending on how run.
319319
self.assertEqual(repr(bar.bar), "<class '%s.bar'>" % bar.__name__)
320320

321-
# TODO: RUSTPYTHON
322-
@unittest.expectedFailure
323321
def test_instance(self):
324322
self._check_path_limitations('baz')
325323
write_file(os.path.join(self.subpkgname, 'baz.py'), '''\
@@ -332,8 +330,6 @@ class baz:
332330
self.assertTrue(repr(ibaz).startswith(
333331
"<%s.baz object at 0x" % baz.__name__))
334332

335-
# TODO: RUSTPYTHON
336-
@unittest.expectedFailure
337333
def test_method(self):
338334
self._check_path_limitations('qux')
339335
eq = self.assertEqual

vm/src/builtins/object.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ impl PyBaseObject {
185185
/// Return repr(self).
186186
#[pymethod(magic)]
187187
fn repr(zelf: PyObjectRef) -> String {
188-
format!("<{} object at {:#x}>", zelf.class().name, zelf.get_id())
188+
format!(
189+
"<{} object at {:#x}>",
190+
zelf.class().tp_name(),
191+
zelf.get_id()
192+
)
189193
}
190194

191195
#[pyclassmethod(magic)]

0 commit comments

Comments
 (0)