Skip to content

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

Merged
merged 3 commits into from
Apr 24, 2020
Merged

Conversation

youknowone
Copy link
Member

No description provided.

@youknowone youknowone force-pushed the fix-bytes-replace branch 2 times, most recently from c2ef0a2 to 758ae73 Compare April 8, 2020 17:48
@youknowone youknowone changed the title Fix bytes.replace (WIP) Fix bytes.replace Apr 8, 2020
@youknowone youknowone changed the title (WIP) Fix bytes.replace Fix bytes.replace Apr 11, 2020
@youknowone youknowone force-pushed the fix-bytes-replace branch 3 times, most recently from c99a11d to c4a041e Compare April 11, 2020 02:47
}

let result_len = self.len() - (count * from.len());
debug_assert!(self.len() >= count * from.len());
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

@youknowone youknowone merged commit 85751dc into RustPython:master Apr 24, 2020
@youknowone youknowone deleted the fix-bytes-replace branch April 24, 2020 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants