Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
gh-143904: Raise OverflowError instead of IndexError for too large offset in struct.pack_into()#143905
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
…rge offset in struct.pack_into()
| buffer: Py_buffer(accept={rwbuffer}) | ||
| offset as offset_obj: object | ||
| offset: Py_ssize_t |
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.
This long-time behavior, I think we need a deprecation.
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.
This behavior is uncommon, it was not documented and not covered by tests, it should not occur in normal code. This looks like a long-time bug, we just do not backport its fix.
It is not easy to deprecate a raised exception, and deprecation will have effect comparable with simple changing the exception type. We usually do not do this.
vstinner 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.
LGTM. It seems safe and reasonable to raise a different exception for this corner case.
1834741 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.