diff options
author | Walter Dörwald <walter@livinglogic.de> | 2007-06-05 13:41:53 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2007-06-05 13:41:53 (GMT) |
commit | a7eb93ec43e0ad18a0c78c93afb85e9cb9fd3f2f (patch) | |
tree | e5fbd31007c92804408643c48ee3b16d247d6462 /Modules/socketmodule.c | |
parent | 787b03ba4b023663074a76b473b143d0a2998c3b (diff) | |
download | cpython-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/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 4 |
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); } |