summaryrefslogtreecommitdiffstats
path: root/Modules
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 /Modules
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 'Modules')
-rw-r--r--Modules/_decimal/_decimal.c2
-rw-r--r--Modules/_json.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index 51aed2c..d977b14 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -5390,7 +5390,7 @@ static PyTypeObject PyDecContext_Type =
0, /* tp_as_mapping */
(hashfunc) 0, /* tp_hash */
0, /* tp_call */
- (reprfunc) context_repr, /* tp_str */
+ 0, /* tp_str */
(getattrofunc) context_getattr, /* tp_getattro */
(setattrofunc) context_setattr, /* tp_setattro */
(PyBufferProcs *) 0, /* tp_as_buffer */
diff --git a/Modules/_json.c b/Modules/_json.c
index 2d7c1bf..4faa9cc 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -1482,7 +1482,7 @@ encoder_listencode_obj(PyEncoderObject *s, _PyAccu *acc,
return _steal_accumulate(acc, encoded);
}
else if (PyLong_Check(obj)) {
- PyObject *encoded = PyLong_Type.tp_str(obj);
+ PyObject *encoded = PyLong_Type.tp_repr(obj);
if (encoded == NULL)
return -1;
return _steal_accumulate(acc, encoded);
@@ -1646,7 +1646,7 @@ encoder_listencode_dict(PyEncoderObject *s, _PyAccu *acc,
goto bail;
}
else if (PyLong_Check(key)) {
- kstr = PyLong_Type.tp_str(key);
+ kstr = PyLong_Type.tp_repr(key);
if (kstr == NULL) {
goto bail;
}