-
Notifications
You must be signed in to change notification settings - Fork 26.3k
fix negative string indexing #22700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix negative string indexing #22700
Conversation
| auto index = pop(stack).toInt(); | ||
| auto string = pop(stack).toStringRef(); | ||
| char c = string.at(index); | ||
| auto norm_index = normalizeIndex(index, string.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you modify the __getitem__ overload for string instead? I think we plan to deprecate those prim operators and all using aten::__getitem__ for indexing #22276
wanchaol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, CI is broken though
|
@pytorchbot rebase this please |
a36bae5 to
73b942f
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eellison is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
strings allow negative indexing in python