Repository navigation
[Python] Use isinstance instead of repr check in RooFit.bindFunction - #23614
Merged
guitargeek merged 2 commits intoOct 7, 2026
Merged
Conversation
The check for C++ functions in bindFunction/bindPdf was using string matching on repr(type(func)), which breaks across cppyy/cppjit versions. Replace with isinstance(func, ROOT._cppyy.types.Function), which works for both because ROOT provides a cppyy compatibility alias. This matches the pattern already used elsewhere in ROOT pythonizations (e.g., _roofit/_utils.py, _rdf_pyz.py) and is the same fix applied to podio in AIDASoft/podio#1031. Assisted-by: pi:claude-sonnet-4
jmcarcell
marked this pull request as draft
October 5, 2026 17:23
jmcarcell
marked this pull request as ready for review
October 5, 2026 17:25
Contributor
|
@jmcarcell There are CI build failures. You'll address them, or you want me to take over? |
Contributor
Author
|
Having a look |
Assisted-by: claude-code:claude-opus-5-5
Contributor
Author
|
Maybe consider adding me to the list of people that don't need their workflows approved manually |
Test Results 24 files 24 suites 3d 22h 32m 25s ⏱️ For more details on these failures, see this check. Results for commit 2fcddb4. |
Contributor
@dpiparo, would that be possible? |
guitargeek
approved these changes
Oct 7, 2026
guitargeek
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Thanks for this targeted fix.
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.
This Pull request:
Changes or fixes:
The check for C++ functions in
bindFunction/bindPdfwas using string matching onrepr(type(func)), which breaks across cppyy/cppjit versions. This PR replaces it withisinstance(func, ROOT._cppyy.types.Function), which works for both because ROOT provides a cppyy compatibility alias.Before:
if "cppjit" in repr(type(func)):After:
if isinstance(func, ROOT._cppyy.types.Function):This matches the pattern already used elsewhere in ROOT pythonizations (e.g.,
_roofit/_utils.py,_rdf_pyz.py) and is the same fix applied to podio in AIDASoft/podio#1031.The AI assistant identified this issue by comparing with the podio fix and searching for similar patterns in the ROOT codebase.
Checklist:
This PR fixes a forward/backward compatibility issue with C++ function detection in RooFit pythonizations.