Skip to content

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