Skip to content

Conversation

@e-luks
Copy link

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

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/setuptools#3942

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.

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/setuptools#3942
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