[issue19561] request to reopen Issue837046 - pyport.h redeclares gethostname() if SOLARIS is defined

Jakub Kulik report at bugs.python.org
Mon Nov 9 08:17:23 EST 2020


Jakub Kulik <kulikjak at gmail.com> added the comment:

I think this code should be removed.

It was added in its current form more than 20 years ago with the intention to add function declarations missing from system include files:
https://github.com/python/cpython/commit/1e0c2f4bee43728930bd5f4dc77283f09c4ba004

Today, every Solaris system should have gethostname() available in unistd.h. I am not sure when exactly was it added, but it was available in the OpenSolaris since the first commit (year 2005):
https://github.com/illumos/illumos-gate/blame/master/usr/src/head/unistd.h#L344


Also, AFAIK, 'SOLARIS' macro is not predefined on Solaris systems in compiler preprocessors today *; hence, unless compiled with `-DSOLARIS`, this code has no effect.

*) I tested this with several GCC [7|9|10] and Solaris studio and neither of those defined it. It seems like it might have worked many years ago, but it certainly isn't a way to #ifdef Solaris today.

----------
nosy: +kulikjak

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue19561>
_______________________________________


More information about the Python-bugs-list mailing list