-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
bpo-20047: Make bytearray methods partition() and rpartition() rejecting #4158
bpo-20047: Make bytearray methods partition() and rpartition() rejecting #4158
Conversation
separators that are not bytes-like objects.
after the separator. If the separator is not found, return a 3-tuple | ||
containing the part before the separator, the separator itself or its | ||
bytearray copy, and the part after the separator. | ||
If the separator is not found, return a 3-tuple |
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.
The change is to add 'itself or its bytearray copy'. The asymmetry surprised me, but it matches current behavior.
>>> b'123456789'.partition(bytearray(b'45'))
(b'123', bytearray(b'45'), b'6789')
>>> bytearray(b'123456789').partition(b'45')
(bytearray(b'123'), bytearray(b'45'), bytearray(b'6789'))
The text and test changes look good.
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6. |
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
…rejecting (pythonGH-4158) separators that are not bytes-like objects.. (cherry picked from commit a231428)
GH-4162 is a backport of this pull request to the 3.6 branch. |
…rejecting (pythonGH-4158) separators that are not bytes-like objects.. (cherry picked from commit a231428)
GH-4163 is a backport of this pull request to the 2.7 branch. |
separators that are not bytes-like objects.
https://bugs.python.org/issue20047