Issue #25548: Showing memory address of class objects in repl
diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py
index 4d554a3..e02a3cb 100644
--- a/Lib/test/test_class.py
+++ b/Lib/test/test_class.py
@@ -568,5 +568,15 @@
a = A(hash(A.f)^(-1))
hash(a.f)
+ def test_class_repr(self):
+ # We should get the address of the object
+ class A:
+ pass
+
+ result = repr(A)
+ self.assertRegex(result,
+ "<class 'test.test_class.ClassTests.test_class_repr.<locals>.A'"
+ " at 0x.+>")
+
if __name__ == '__main__':
unittest.main()