bpo-36793: Remove unneeded __str__ definitions. (GH-13081)
Classes that define __str__ the same as __repr__ can
just inherit it from object.
diff --git a/Lib/json/encoder.py b/Lib/json/encoder.py
index 2d7b898..c8c78b9 100644
--- a/Lib/json/encoder.py
+++ b/Lib/json/encoder.py
@@ -268,7 +268,7 @@
list=list,
str=str,
tuple=tuple,
- _intstr=int.__str__,
+ _intstr=int.__repr__,
):
if _indent is not None and not isinstance(_indent, str):
@@ -307,7 +307,7 @@
elif value is False:
yield buf + 'false'
elif isinstance(value, int):
- # Subclasses of int/float may override __str__, but we still
+ # Subclasses of int/float may override __repr__, but we still
# want to encode them as integers/floats in JSON. One example
# within the standard library is IntEnum.
yield buf + _intstr(value)