summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-11-01 17:54:32 (GMT)
committerGitHub <noreply@github.com>2023-11-01 17:54:32 (GMT)
commit5d6db168b9cda58b4897763041a6109b93e421cb (patch)
tree01f84377c284868c110d51dc0f1faca37a179f29 /Modules
parentd9b606b3d04fc56fb0bcc479d7d6c14562edb5e2 (diff)
downloadcpython-5d6db168b9cda58b4897763041a6109b93e421cb.zip
cpython-5d6db168b9cda58b4897763041a6109b93e421cb.tar.gz
cpython-5d6db168b9cda58b4897763041a6109b93e421cb.tar.bz2
Simplify trivial calls of PyUnicode_FromFormat() (GH-111605)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_xxsubinterpretersmodule.c2
-rw-r--r--Modules/_zoneinfo.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c
index 640fd69..ce0d511 100644
--- a/Modules/_xxsubinterpretersmodule.c
+++ b/Modules/_xxsubinterpretersmodule.c
@@ -307,7 +307,7 @@ _sharedexception_bind(PyObject *exc, int code, _sharedexception *sharedexc)
}
if (exc != NULL) {
- PyObject *msgobj = PyUnicode_FromFormat("%S", exc);
+ PyObject *msgobj = PyObject_Str(exc);
if (msgobj == NULL) {
failure = "unable to format exception message";
code = ERR_NO_MEMORY;
diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c
index 97e5501..77644c3 100644
--- a/Modules/_zoneinfo.c
+++ b/Modules/_zoneinfo.c
@@ -420,7 +420,7 @@ zoneinfo_ZoneInfo_from_file_impl(PyTypeObject *type, PyTypeObject *cls,
return NULL;
}
- file_repr = PyUnicode_FromFormat("%R", file_obj);
+ file_repr = PyObject_Repr(file_obj);
if (file_repr == NULL) {
goto error;
}