Skip to content

Commit

Permalink
Simplify trivial calls of PyUnicode_FromFormat() (GH-111605)
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka authored Nov 1, 2023
1 parent d9b606b commit 5d6db16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Modules/_xxsubinterpretersmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Modules/_zoneinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5d6db16

Please sign in to comment.