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

relax speedups str check #477

Merged
merged 2 commits into from
Oct 17, 2024
Merged

relax speedups str check #477

merged 2 commits into from
Oct 17, 2024

Conversation

davidism
Copy link
Member

__str__ should return a str, but could return a subclass of str instead. Relax the C check from PyUnicode_CheckExact (exact type) to PyUnicode_Check (subclass). This will still fail if __str__ returns a non-string, but at that point I'm calling it a bug in the code that does that.

fixes #472

Also added a test for #467.

@davidism davidism added this to the 3.0.2 milestone Oct 17, 2024
@davidism davidism changed the base branch from main to 3.0.x October 17, 2024 00:13
@davidism davidism merged commit e85aff4 into 3.0.x Oct 17, 2024
12 checks passed
@davidism davidism deleted the str-exact branch October 17, 2024 00:18
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

escape() fails with certain str subclasses
1 participant