summaryrefslogtreecommitdiffstats
path: root/Lib/json
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-05-06 19:29:40 (GMT)
committerGitHub <noreply@github.com>2019-05-06 19:29:40 (GMT)
commit96aeaec64738b730c719562125070a52ed570210 (patch)
treed68994f93014d081e9a441e7bf7dfda3aaadd402 /Lib/json
parent964663089547ca110199e23867b46b07ff4be88c (diff)
downloadcpython-96aeaec64738b730c719562125070a52ed570210.zip
cpython-96aeaec64738b730c719562125070a52ed570210.tar.gz
cpython-96aeaec64738b730c719562125070a52ed570210.tar.bz2
bpo-36793: Remove unneeded __str__ definitions. (GH-13081)
Classes that define __str__ the same as __repr__ can just inherit it from object.
Diffstat (limited to 'Lib/json')
-rw-r--r--Lib/json/encoder.py4
1 files changed, 2 insertions, 2 deletions
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 @@ def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
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 @@ def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
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)