mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Simplify socket_repr() by using PyUnicode_FromFormat()
directly. Add a test that calls socket_repr().
This commit is contained in:
parent
787b03ba4b
commit
a7eb93ec43
2 changed files with 5 additions and 3 deletions
|
@ -2787,13 +2787,11 @@ sock_repr(PySocketSockObject *s)
|
|||
return NULL;
|
||||
}
|
||||
#endif
|
||||
PyOS_snprintf(
|
||||
buf, sizeof(buf),
|
||||
return PyUnicode_FromFormat(
|
||||
"<socket object, fd=%ld, family=%d, type=%d, proto=%d>",
|
||||
(long)s->sock_fd, s->sock_family,
|
||||
s->sock_type,
|
||||
s->sock_proto);
|
||||
return PyUnicode_FromString(buf);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue