Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow unicode surrogates to be stored in str #4726

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

Closed
wants to merge 1 commit into from

Conversation

garychia
Copy link
Contributor

Related to #4470 .
This pull request attempts to allow RustPython to store unicode surrogates in a str.

@youknowone
Copy link
Member

This is potentially not safe. Rust will fill the unused char ranges with other values when it can do. (if not yet, it can do those optimization in future)
To correctly fix this problem, #3574 need to be finished.
are you interested in it?

@garychia
Copy link
Contributor Author

I'm still looking for a better solution for this. Sure. I'll take a look at #3574. Thanks.

@garychia garychia closed this Mar 25, 2023
@garychia garychia deleted the unicode_surrogates branch March 25, 2023 08:59
@youknowone
Copy link
Member

@garychia did you get any idea about it?

@garychia
Copy link
Contributor Author

Currently the parser uses Rust chars and strings to handle Python string literals. This does not work with Unicode surrogate characters. We may need to change the way we store Python string literals. My suggestion is to replace Rust strings with our custom class (such as PyStr, I guess). But I guess this may require a lot of work to be done.

@fanninpm
Copy link
Contributor

Perhaps the bstr crate can be useful.

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.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.