Skip to content

Commit 93e1bd1

Browse files
committed
move format string into a variable
1 parent 8c485ea commit 93e1bd1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎Python/gc.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -999,8 +999,9 @@ clear_weakrefs(PyGC_Head *unreachable)
999999
static char *
10001000
debug_cycle(const char *msg, PyObject *op)
10011001
{
1002+
const char fmt[] = "gc: %s <%s %p>\n";
10021003
const char *name = Py_TYPE(op)->tp_name;
1003-
int len = PyOS_snprintf(NULL, 0, "gc: %s <%s %p>\n",
1004+
int len = PyOS_snprintf(NULL, 0, fmt,
10041005
msg, name, (void *)op);
10051006
if (len < 0) {
10061007
return NULL;
@@ -1009,7 +1010,7 @@ debug_cycle(const char *msg, PyObject *op)
10091010
if (line == NULL) {
10101011
return NULL;
10111012
}
1012-
PyOS_snprintf(line, (size_t)len + 1, "gc: %s <%s %p>\n",
1013+
PyOS_snprintf(line, (size_t)len + 1, fmt,
10131014
msg, name, (void *)op);
10141015
return line;
10151016
}

0 commit comments

Comments
 (0)