Skip to content

Conversation

@e-luks
Copy link

@e-luks e-luks commented Dec 20, 2025

Summary of changes

Parallel builds of extensions that share source files may write to the same object file paths under a common build directory, resulting in race conditions and non-deterministic build outputs.

Use a per-extension subdirectory within build_temp to isolate object files and ensure deterministic, parallel-safe builds.

Pull Request Checklist

Tests

I tested this change downstream at Gentoo after encountering https://bugs.gentoo.org/967476 and https://bugs.gentoo.org/945376 (packages https://pypi.org/project/librt and https://pypi.org/project/pymongo/). Since the build failures are encountered non-determinstically, i compiled both librt and pymongo as often as needed, capping the compilation attempts to 100.

  • Before the change I encountered the build failures after at most 10 compilations
  • After the change I didn't encounter the issue, compiling both librt and pymongo successfully 100 times.

e-luks added a commit to e-luks/gentoo that referenced this pull request Dec 20, 2025
…ension builds

Parallel builds of extensions that share source files may write to the same
object file paths under a common build directory, resulting in race conditions
and non-deterministic build outputs.

Use a per-extension subdirectory within build_temp to isolate object files and
ensure deterministic, parallel-safe builds.

Bug: https://bugs.gentoo.org/967476
Bug: https://bugs.gentoo.org/945376
See-also: pypa/setuptools#5132
Signed-off-by: Lukas Schmelting <[email protected]>
e-luks added a commit to e-luks/gentoo that referenced this pull request Dec 20, 2025
…ension builds

Parallel builds of extensions that share source files may write to the same
object file paths under a common build directory, resulting in race conditions
and non-deterministic build outputs.

Use a per-extension subdirectory within build_temp to isolate object files and
ensure deterministic, parallel-safe builds.

Bug: https://bugs.gentoo.org/967476
Bug: https://bugs.gentoo.org/945376
See-also: pypa/setuptools#5132
Signed-off-by: Lukas Schmelting <[email protected]>
Parallel builds of extensions that share source files may write to the same
object file paths under a common build directory, resulting in race conditions
and non-deterministic build outputs.

Use a per-extension build directory to isolate object files and ensure
deterministic, parallel-safe builds.

Bug: pypa#3942
@e-luks e-luks force-pushed the fix-extension-build-object-file-collisions branch from ca715f5 to 13c9751 Compare December 20, 2025 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant