Load CppInterOp explicitly and resolve it relative to libcppjit - #21
Open
aaronj0 wants to merge 5 commits into
Open
Load CppInterOp explicitly and resolve it relative to libcppjit#21aaronj0 wants to merge 5 commits into
aaronj0 wants to merge 5 commits into
Conversation
Test Results
|
aaronj0
force-pushed
the
explicit-load-dladdr
branch
from
August 17, 2026 23:41
6d3bf8a to
dd99613
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The backend used to dlopen
libclangCppInterOpinside a global constructor and locate it through absolute build-time paths, so a wheel built on one machine could not load on another. A constructor also runs under the loader lock, inside the dlopen oflibcppjititself: the nested dlopen re-enters the loader on partially consistent state, runs the inner library's initializers with no ordering guarantees, and holds the lock through the entire interpreter and JIT setup, deadlocking any other thread that touches the loader (as reported by @Vipul-Cariappa)The ctor also had no error channel: on failure, the old code only prints and leave a half-initialized library. With this patch the explicit
LoadCppInterOp()runs after loading completes and returns a status that turns into a proper exception on the Python side.This PR implements the following:
LoadCppInterOp()that_cpython_cppjit.pycalls before the extension module importValidation:
environment is deleted
libcppjit.so