Skip to content
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

Merged
merged 2 commits into from Oct 28, 2017

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Oct 28, 2017

separators that are not bytes-like objects.

https://bugs.python.org/issue20047

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
Copy link
Member

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.

@serhiy-storchaka serhiy-storchaka merged commit a231428 into python:master Oct 28, 2017
@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the bytearray-partition branch October 28, 2017 23:12
@miss-islington
Copy link
Contributor

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.6 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker a2314283ff87c65e1745a42c2f2b716b1a209128 3.6

@miss-islington
Copy link
Contributor

Sorry, @serhiy-storchaka, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker a2314283ff87c65e1745a42c2f2b716b1a209128 2.7

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Oct 29, 2017
…rejecting (pythonGH-4158)

separators that are not bytes-like objects..
(cherry picked from commit a231428)
@bedevere-bot
Copy link

GH-4162 is a backport of this pull request to the 3.6 branch.

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Oct 29, 2017
…rejecting (pythonGH-4158)

separators that are not bytes-like objects..
(cherry picked from commit a231428)
@bedevere-bot
Copy link

GH-4163 is a backport of this pull request to the 2.7 branch.

serhiy-storchaka added a commit that referenced this pull request Oct 29, 2017
…rejecting (GH-4158) (#4162)

separators that are not bytes-like objects..
(cherry picked from commit a231428)
serhiy-storchaka added a commit that referenced this pull request Oct 29, 2017
…rejecting (GH-4158) (#4163)

separators that are not bytes-like objects..
(cherry picked from commit a231428)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants