Call spec.loader.exec_module in _load_pybind11_module utility#835
Merged
scotts merged 1 commit intometa-pytorch:mainfrom Aug 22, 2025
Merged
Call spec.loader.exec_module in _load_pybind11_module utility#835scotts merged 1 commit intometa-pytorch:mainfrom
scotts merged 1 commit intometa-pytorch:mainfrom
Conversation
Collaborator
Author
5 tasks
Collaborator
Author
|
There are some test failures, but they do not seem related to the PR (see https://github.com/pytorch/torchcodec/actions/runs/17136952598/job/48617188664 for another PR with similar failures). |
NicolasHug
approved these changes
Aug 22, 2025
Contributor
NicolasHug
left a comment
There was a problem hiding this comment.
Thanks for the PR @traversaro , this LGTM. I... don't understand why this may or may not be needed either, but if it fixes something on conda-forge then sure.
Waiting on @scotts to take a look
scotts
approved these changes
Aug 22, 2025
Contributor
scotts
left a comment
There was a problem hiding this comment.
@traversaro, great catch! It looks like we definitely need to do this.
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.
I am not 100% sure about this change, but without this change the torchcodec build of conda-forge fails after the upgrade from pybind11 2.* to pybind11 3.* during tests with error like:
to be honest, I do not know enough about Python module loading to understand why this happens in conda-forge CI, and not in torchcodec CI that also uses pybind11
3.*. However, the problem goes away if after loading the module, we also executespec.loader.exec_module. Looking around it seems that this may be related to multi-phase init (for example pybind/pybind11#5574), but to be honest I do not know enough about that to understand if that is the case.See conda-forge/torchcodec-feedstock#27 for the downstream related PR.