[New-bugs-announce] [issue36588] change sys.platform() to just "aix" for AIX

Michael Felt report at bugs.python.org
Wed Apr 10 11:04:50 EDT 2019


New submission from Michael Felt <aixtools at felt.demon.nl>:

This is something that probably shouts - boring - but back in 2012 it was a hot topic for linux2 and linux3.

Maybe - as far back as 1996 (when AIX4 was new) "aix3" and "aix4" made sense. Whether that is true, or not - is pointless these days - for Python3.

In the python code I have reviewed - for various reasons - I have never seen any code with "sys.platform() == "aixX" (where X is any of 5, 6, 7).

There was a reference to "aix3" and "aix4" in setup.py (recently removed, and there is no replacement for aix5, aix6, or aix7 - not needed!)

What I mostly see is sys.platform.startswith("aix"). The other form of the same test is sys.platform[:3] == 'aix'

sys.platform is "build" related, e.g., potentially bound to libc issues. Even if this was the case (AIX offers since 2007 - official binary compatibility from old to new (when libc is dynamically linked, not static linked), was "unofficial" for aix3 and aix4).

Yes, I am sure there are arguments along the line of "why change" since we have been updating it - always, and/or the documentation says so.

linux2 had to stay, because there was known code that compared with linux2 (and that code was having problems when python was built on linux3 - hence the change to make sys.platform return linux2 for all Python3.2 and younger).

FYI: in Cpython (master) there are no references to "aixX".

All the references there are (in .py) are:

michael at x071:[/data/prj/python/git/cpython-master]find . -name \*.py | xargs egrep "[\"']aix"
./Lib/asyncio/unix_events.py:        if is_socket or (is_fifo and not sys.platform.startswith("aix")):
./Lib/ctypes/__init__.py:        if _sys.platform.startswith("aix"):
./Lib/ctypes/util.py:elif sys.platform.startswith("aix"):
./Lib/ctypes/util.py:        elif sys.platform.startswith("aix"):
./Lib/distutils/command/build_ext.py:        elif sys.platform[:3] == 'aix':
./Lib/distutils/util.py:    elif osname[:3] == "aix":
./Lib/sysconfig.py:    elif osname[:3] == "aix":
./Lib/test/test_asyncio/test_events.py:    if sys.platform.startswith("aix"):
./Lib/test/test_faulthandler.py:    @unittest.skipIf(sys.platform.startswith('aix'),
./Lib/test/test_strftime.py:        or sys.platform.startswith(("aix", "sunos", "solaris"))):
./Lib/test/test_strptime.py:    @unittest.skipIf(sys.platform.startswith('aix'),
./Lib/test/test_locale.py:    @unittest.skipIf(sys.platform.startswith('aix'),
./Lib/test/test_locale.py:    @unittest.skipIf(sys.platform.startswith('aix'),
./Lib/test/test_fileio.py:                       not sys.platform.startswith(('sunos', 'aix')):
./Lib/test/test_tools/test_i18n.py:    @unittest.skipIf(sys.platform.startswith('aix'),
./Lib/test/test_wait4.py:        if sys.platform.startswith('aix'):
./Lib/test/test_c_locale_coercion.py:elif sys.platform.startswith("aix"):
./Lib/test/test_shutil.py:AIX = sys.platform[:3] == 'aix'
./Lib/test/test_utf8_mode.py:        elif sys.platform.startswith("aix"):

I'll write the patch - if I recall it should be a one-liner in configure.ac, but I think some discussion (or blessing) first is appropriate.

Maybe even review whether other platforms no longer rely on the X for the platform.

Hoping this helps!

----------
components: Build
messages: 339869
nosy: Michael.Felt
priority: normal
severity: normal
status: open
title: change sys.platform() to just "aix" for AIX
versions: Python 3.8, Python 3.9

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


More information about the New-bugs-announce mailing list