KEMBAR78
gh-115323: Add meaningful error message for using bytearray.extend with str by jayasting98 · Pull Request #115332 · python/cpython · GitHub
Skip to content

Conversation

@jayasting98
Copy link
Contributor

@jayasting98 jayasting98 commented Feb 12, 2024

Fixes #115323

  • Check if the iterable is an instance of str
  • Raise a TypeError when the iterable is an instance of str, with a more meaningful error message that says the string should be encoded

@ghost
Copy link

ghost commented Feb 12, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Feb 12, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app
Copy link

bedevere-app bot commented Feb 13, 2024

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@jayasting98
Copy link
Contributor Author

I have made the requested changes; please review again

@terryjreedy
Copy link
Member

@sobolevn Ok to merge?

@terryjreedy terryjreedy added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Feb 24, 2024
@terryjreedy terryjreedy merged commit 948acd6 into python:main Feb 24, 2024
@miss-islington-app
Copy link

Thanks @jayasting98 for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 24, 2024
…end with str (pythonGH-115332)

Perform str check after TypeError is raised
---------

(cherry picked from commit 948acd6)

Co-authored-by: Jay Ting <65202977+jayasting98@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
@bedevere-app
Copy link

bedevere-app bot commented Feb 24, 2024

GH-115894 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Feb 24, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 24, 2024
…end with str (pythonGH-115332)

Perform str check after TypeError is raised
---------

(cherry picked from commit 948acd6)

Co-authored-by: Jay Ting <65202977+jayasting98@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
@bedevere-app
Copy link

bedevere-app bot commented Feb 24, 2024

GH-115895 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Feb 24, 2024
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
…end with str (python#115332)

Perform str check after TypeError is raised
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
…end with str (python#115332)

Perform str check after TypeError is raised
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
LukasWoodtli pushed a commit to LukasWoodtli/cpython that referenced this pull request Jan 22, 2025
…end with str (python#115332)

Perform str check after TypeError is raised
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
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.

bytearray.extend: Misleading error message

5 participants