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

rewrite gap buffer to use bytearrays instead of array.array('u', ...) #56

Open
kcr opened this issue Jun 11, 2017 · 2 comments
Open

rewrite gap buffer to use bytearrays instead of array.array('u', ...) #56

kcr opened this issue Jun 11, 2017 · 2 comments

Comments

@kcr
Copy link
Collaborator

kcr commented Jun 11, 2017

because arrary.array('u', n) is deprecated and bytearrays are part of the core language now

@asedeno
Copy link

asedeno commented Oct 6, 2020

I've looked into this and it's frustrating because array.array('u', n) is a container of characters (PY_UNICODE, and later wchar_t), not bytes, so to switch one would need to manage characters at byte level with some encoding. It may be easier to detect an array.array type that is 4 bytes and use that along with UCS-4/UTF-32. I'm hopeful that https://bugs.python.org/issue36299 will yield an alternative before this becomes an issue.

@asedeno
Copy link

asedeno commented Jul 10, 2023

Python 3.12 will have a UCS-4 array type of 'w', so there's a reasonable transition path: if we find 'w' in array.typecodes then we use it, otherwise we keep using 'u'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants