Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 41941:e4ab08039c75
Simplify socket_repr() by using PyUnicode_FromFormat()
directly. Add a test that calls socket_repr().
| author | Walter Dörwald <walter@livinglogic.de> |
|---|---|
| date | Tue, 05 Jun 2007 13:41:53 +0000 |
| parents | 8e062e572ea4 |
| children | 73dd2da31d37 |
line wrap: on
line diff
--- a/Modules/socketmodule.c Tue Jun 05 13:29:29 2007 +0000 +++ b/Modules/socketmodule.c Tue Jun 05 13:41:53 2007 +0000 @@ -2787,13 +2787,11 @@ 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); }
