-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix bytes.replace #1847
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 bytes.replace #1847
Conversation
c2ef0a2
to
758ae73
Compare
98788d8
to
5a1cf21
Compare
c99a11d
to
c4a041e
Compare
c4a041e
to
637c255
Compare
} | ||
|
||
let result_len = self.len() - (count * from.len()); | ||
debug_assert!(self.len() >= count * from.len()); |
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.
maybe remove this? I know is is only in debug but it does not provide additional data.
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 is line by line port of CPython implementation. Do you still want to remove this regardless of it?
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.
I am OK with you keeping this. Just not sure if that is necessary. Your call.
|
||
// Check for overflow | ||
// result_len = self_len + count * (to_len-from_len) | ||
debug_assert!(count > 0); |
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.
Do we need this?
637c255
to
67a9dfd
Compare
No description provided.