Simplify trivial calls of PyUnicode_FromFormat() (GH-111605)

This commit is contained in:
Serhiy Storchaka 2023-11-01 19:54:32 +02:00 committed by GitHub
parent d9b606b3d0
commit 5d6db168b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -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;

View file

@ -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;
}