[New-bugs-announce] [issue18259] Declare sethostname in socketmodule.c for AIX

David Edelsohn report at bugs.python.org
Wed Jun 19 00:25:52 CEST 2013

New submission from David Edelsohn:

AIX provides sethostname() but it is not declared in any useful header. Fixed as follows:

diff -r 626a8e49f2a9 Modules/socketmodule.c
--- a/Modules/socketmodule.c    Tue Jun 18 23:28:18 2013 +0200
+++ b/Modules/socketmodule.c    Tue Jun 18 20:17:37 2013 -0700
@@ -4066,6 +4066,10 @@
     Py_buffer buf;
     int res, flag = 0;
+#ifdef _AIX
+extern int sethostname(const char *, size_t);
     if (!PyArg_ParseTuple(args, "S:sethostname", &hnobj)) {
         if (!PyArg_ParseTuple(args, "O&:sethostname",

It seemed best to declare it inside the function. I placed it below the other declarations, not immediately before the function use.

components: Build
messages: 191439
nosy: David.Edelsohn, haypo
priority: normal
severity: normal
status: open
title: Declare sethostname in socketmodule.c for AIX
type: compile error
versions: Python 3.3, Python 3.4, Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list