[Python-bugs-list] [ python-Bugs-837046 ] pyport.h redeclares gethostname() if SOLARIS is defined

SourceForge.net noreply at sourceforge.net
Thu Nov 6 03:09:52 EST 2003


Bugs item #837046, was opened at 2003-11-06 09:09
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=837046&group_id=5470

Category: None
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: James Bostock (jbostock)
Assigned to: Nobody/Anonymous (nobody)
Summary: pyport.h redeclares gethostname() if SOLARIS is defined

Initial Comment:
The file pyport.h contains the lines:

#ifdef SOLARIS
/* Unchecked */
extern int gethostname(char *, int);
#endif

However, Solaris already defines gethostname() 
in /usr/include/unistd.h [I only have access to Solaris 
2.6 and 2.8 so I can't vouch for other versions].

This in iteself is not a problem. However, under 
Python2.3, pyconfig.h defines _XOPEN_SOURCE and 
_XOPEN_SOURCE_EXTENDED which cause (indirectly) 
the following prototype to be selected from unitstd.h:

extern int gethostname(char *, size_t);

Since size_t is an unsigned char, a compiler error 
message is generated (both by the native compiler and 
gcc) saying that the function has been redefined.
This means that no python program can be compiled if 
SOLARIS is #defined.

I imagine that the above code from pyport.h is only 
applicable to an earlier version of Solaris than 2.6, and 
so should either be removed or qualified somehow.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=837046&group_id=5470



More information about the Python-bugs-list mailing list