summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-06-05 13:41:53 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-06-05 13:41:53 (GMT)
commita7eb93ec43e0ad18a0c78c93afb85e9cb9fd3f2f (patch)
treee5fbd31007c92804408643c48ee3b16d247d6462 /Modules
parent787b03ba4b023663074a76b473b143d0a2998c3b (diff)
downloadcpython-a7eb93ec43e0ad18a0c78c93afb85e9cb9fd3f2f.zip
cpython-a7eb93ec43e0ad18a0c78c93afb85e9cb9fd3f2f.tar.gz
cpython-a7eb93ec43e0ad18a0c78c93afb85e9cb9fd3f2f.tar.bz2
Simplify socket_repr() by using PyUnicode_FromFormat()
directly. Add a test that calls socket_repr().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/socketmodule.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index eca29dd..4ae745c 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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);
}