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

Support str subclasses in libyaml extension #768

Open
nitzmahone opened this issue Nov 29, 2023 · 0 comments
Open

Support str subclasses in libyaml extension #768

nitzmahone opened this issue Nov 29, 2023 · 0 comments
Assignees

Comments

@nitzmahone
Copy link
Member

The libyaml Cython wrapper uses PyUnicode_CheckExact around all C string accesses instead of PyUnicode_Check; this prevents str subclasses from being used anywhere with the C-accelerated types, and the varying error conditions when a subclass is encountered can frustrate diagnosis of the underlying problem.

I've already gotten this working with string inputs to load by switching to PyUnicode_Check for just that arg in the CParser init, but fixing it everywhere will require some new tests to ensure that things actually behave properly. Off the top of my head, I can't think of a reason why we wouldn't be able to support proper str subclasses (ie, those that have the same basic C layout as str, not just anything that passes __subclasscheck__).

@nitzmahone nitzmahone self-assigned this Nov 29, 2023
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

No branches or pull requests

1 participant