Fix get_nested_resource_ptr to accept both str and bytes inputs#1665
Open
rparolin wants to merge 4 commits intoNVIDIA:mainfrom
Open
Fix get_nested_resource_ptr to accept both str and bytes inputs#1665rparolin wants to merge 4 commits intoNVIDIA:mainfrom
rparolin wants to merge 4 commits intoNVIDIA:mainfrom
Conversation
The char resource path in get_nested_resource_ptr previously only handled str inputs via a Cython <str?> cast, which would reject bytes objects. This updates the logic to explicitly handle str, bytes, and raise a clear TypeError for other types, enabling users to pass bytes-encoded options to APIs like nvjitlink and nvvm. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Collaborator
Author
|
/ok to test |
|
mdboom
requested changes
Feb 20, 2026
| obj_i_bytes = (<str?>(obj_i)).encode() | ||
| obj_i_type = type(obj_i) | ||
| if obj_i_type is str: | ||
| obj_i_bytes = obj_i.encode() |
Contributor
There was a problem hiding this comment.
We should specify an encoding here, since the default is system/installation specific prior to Python 3.15. Probably utf-8 is the right choice, unless the options aren't unicode-safe. The nvvm.h header doesn't really say...
Collaborator
Author
|
/ok to test |
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.
Summary
get_nested_resource_ptrinutils.pyxto accept bothstrandbytesinputs for char resources, instead of onlystrvia a Cython<str?>castTypeErrorwhen neitherstrnorbytesis providedCloses #1354
🤖 Generated with Claude Code