[python] Anchor the cpyrt header probe on the extension module - #25
Open
aaronj0 wants to merge 1 commit into
Open
[python] Anchor the cpyrt header probe on the extension module#25aaronj0 wants to merge 1 commit into
aaronj0 wants to merge 1 commit into
Conversation
Test Results
|
| apipath_extra = os.path.join( | ||
| os.path.dirname(_spec.origin), "cppjit_backend", "include" | ||
| ) | ||
| del _spec |
Collaborator
There was a problem hiding this comment.
Suggested change
| del _spec |
Why do we need to explicitly delete here? Wouldn't the GC collect it if it doesn't have any active references?
Collaborator
Author
There was a problem hiding this comment.
This is in module scope, the GC will only collect _spec once nothing references it, but here the module itself keeps a reference for the process lifetime (the assignment retains it as cppjit._spec), and it shows up in dir(cppjit). The del drops that. We already do del on apipath_extra, include_path, apipath, ispypy for the same reason (also only required at init time and not a part of dir(cppjit))
In editable installs the cpyrt header probe checked `__file__`, which maps to the source tree, so it missed the headers installed by scikit-build-core into site-packages and warned on every import. Now use the libcppjit extension's location, which resolves editable and regular installs identically. Also remove all dead lookups inherited with the probe (the `cpyrt` pip-distribution query via pkg_resources and the site/pythonX.Y layout guesses). `CPPJIT_API_PATH` still overrides and `"none"` still disables.
aaronj0
force-pushed
the
editable-cpyrt-probe
branch
from
August 19, 2026 07:33
8ae9b2e to
9df3efe
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.
In editable installs the cpyrt header probe checked
__file__, which maps to the source tree, so it missed the headers installed by scikit-build-core into site-packages and warned on every import. Now use the libcppjit extension's location, which resolves editable and regular installs identically. Also removes all dead lookups inherited with the probe (thecpyrtpip-distribution query via pkg_resources and the site/pythonX.Y layout guesses).CPPJIT_API_PATHstill overrides and"none"still disables.