Bug
setup.py always runs the structure generator, whose verification imports ics from gen/. When a previous extension exists there, this loads that .pyd into the setup process. Windows then prevents build_ext --inplace from replacing the loaded file.
Reviewed commit: 45167e09de6b886cd451a4245f842c8221349711 (current master on 2026-09-15).
Source: setup.py:17; generate_icsneo40_structs.py:740
Reproduction
In a Windows checkout that already has gen/ics/ics.cp314-win_amd64.pyd:
python setup.py build_ext --inplace --force
Close unrelated Python processes first. The setup process itself imports the destination extension during generator verification.
Observed / expected
Compilation and linking complete successfully, followed by error: could not delete 'gen\ics\ics.cp314-win_amd64.pyd': Access is denied. Copying the newly built extension succeeds after the setup process exits; the copied rebuild passes all 30 tests. Expected the normal in-place rebuild to complete in one command.
Suggested fix and regression coverage
Run generated-module validation in a subprocess that exits before the extension copy, or avoid loading the native extension during generation. Add a Windows check that performs two consecutive in-place builds.
Validation environment
Windows x64, CPython 3.14.5, extension rebuilt from the commit above. Hardware-dependent entry points below were exercised with a mock DLL, not a connected device. The existing 30 tests pass despite these findings.
Bug
setup.py always runs the structure generator, whose verification imports ics from gen/. When a previous extension exists there, this loads that .pyd into the setup process. Windows then prevents build_ext --inplace from replacing the loaded file.
Reviewed commit:
45167e09de6b886cd451a4245f842c8221349711(current master on 2026-09-15).Source: setup.py:17; generate_icsneo40_structs.py:740
Reproduction
In a Windows checkout that already has
gen/ics/ics.cp314-win_amd64.pyd:Close unrelated Python processes first. The setup process itself imports the destination extension during generator verification.
Observed / expected
Compilation and linking complete successfully, followed by
error: could not delete 'gen\ics\ics.cp314-win_amd64.pyd': Access is denied. Copying the newly built extension succeeds after the setup process exits; the copied rebuild passes all 30 tests. Expected the normal in-place rebuild to complete in one command.Suggested fix and regression coverage
Run generated-module validation in a subprocess that exits before the extension copy, or avoid loading the native extension during generation. Add a Windows check that performs two consecutive in-place builds.
Validation environment
Windows x64, CPython 3.14.5, extension rebuilt from the commit above. Hardware-dependent entry points below were exercised with a mock DLL, not a connected device. The existing 30 tests pass despite these findings.