summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-06-05 13:49:43 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-06-05 13:49:43 (GMT)
commit0bbd8abe6b890e296141a4311b361f81af2e4b2c (patch)
tree89892ad74c51215fe83b36dc7894f6b948b68a3e /Modules
parent9cb0802cb591bc2559743271450e8a064438e5b7 (diff)
downloadcpython-0bbd8abe6b890e296141a4311b361f81af2e4b2c.zip
cpython-0bbd8abe6b890e296141a4311b361f81af2e4b2c.tar.gz
cpython-0bbd8abe6b890e296141a4311b361f81af2e4b2c.tar.bz2
Simplify os_init() implementations by using PyErr_Format()
directly instead of PyOS_snprintf()+PyErr_SetString().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/socketmodule.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 2077023..94dddda 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -4045,7 +4045,6 @@ os_init(void)
{
WSADATA WSAData;
int ret;
- char buf[100];
ret = WSAStartup(0x0101, &WSAData);
switch (ret) {
case 0: /* No error */
@@ -4062,9 +4061,7 @@ os_init(void)
"WSAStartup failed: requested version not supported");
break;
default:
- PyOS_snprintf(buf, sizeof(buf),
- "WSAStartup failed: error code %d", ret);
- PyErr_SetString(PyExc_ImportError, buf);
+ PyErr_Format(PyExc_ImportError, "WSAStartup failed: error code %d", ret);
break;
}
return 0; /* Failure */
@@ -4082,16 +4079,13 @@ static int
os_init(void)
{
#ifndef PYCC_GCC
- char reason[64];
int rc = sock_init();
if (rc == 0) {
return 1; /* Success */
}
- PyOS_snprintf(reason, sizeof(reason),
- "OS/2 TCP/IP Error# %d", sock_errno());
- PyErr_SetString(PyExc_ImportError, reason);
+ PyErr_Format(PyExc_ImportError, "OS/2 TCP/IP Error# %d", sock_errno());
return 0; /* Failure */
#else