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

[3.0.x] Fix type of str call #6171

Open
wants to merge 3 commits into
base: 3.0.x
Choose a base branch
from
Open

Conversation

da-woods
Copy link
Contributor

If the type of a call to str has already been deduced as unicode (because of language_level=3), then keep that type.

This was causing optimizations to fail, where the optimization was made on the basis that the type was unicode and then that was reversed by the replacement of str.

Fixes #6166.

Most of this doesn't need to go into 3.1.

If the type of a call to `str` has already been deduced as
unicode (because of language_level=3), then keep that type.

This was causing optimizations to fail, where the optimization
was made on the basis that the type was unicode and then that
was reversed by the replacement of `str`.

Fixes cython#6166.

Most of this doesn't need to go into 3.1.
if node.type is Builtin.unicode_type:
node_type = ExprNodes.UnicodeNode
else:
node_type = ExprNodes.BytesNode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this still be StringNode in 3.0.x?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should... Just spotted that myself

@matusvalo matusvalo linked an issue May 12, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Cannot be executed without any error message.
2 participants