--- ./numpy/f2py/tests/test_compile_function.py_orig	2023-09-06 06:37:53.251633564 +0000
+++ ./numpy/f2py/tests/test_compile_function.py	2023-09-06 06:38:49.116149537 +0000
@@ -81,6 +81,10 @@
             # Removal from sys.modules, is not as such necessary. Even with
             # removal, the module (dict) stays alive.
             del sys.modules[modname]
+            # On AIX, you cannot compile the .so if it was previously loaded.
+            # We must clean it before
+            if sys.platform == 'aix':
+                os.remove(os.path.join(moddir, modname + ".so"))
 
 
 def test_f2py_init_compile_failure():
