-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
array: Add 'w' type and deprecate 'u' type. #80480
Comments
The doc says:
But DeprecationWarning is not raised yet. Let's raise it.
|
'4.0' is a stand-in for 'sometime after 2.7.final', scheduled for Jan 2020. A Pending... for 3.8.0, scheduled for Oct 2019, seems reasonable to me. Perhaps we should have a pydev discussion for the general issue of post 2.7 removals of already deprecated items. |
https://mail.python.org/pipermail/python-dev/2019-March/156807.html We may able to convert 'u' to wchar_t to int32_t and un-deprecate it. |
I found converting Py_UNICODE to Py_UCS4 wad happened, and reverted. |
I think the problem is still whether to use 'u' == UCS2 and 'w' == UCS4 like in PEP-3118. For the project I'm currently working on I'd need these for buffer exports: >>> from xnd import *
>>> x = xnd(["abc", "xyz"], dtype="fixed_string(10, 'utf16')")
>>> y = xnd(["abc", "xyz"], dtype="fixed_string(10, 'utf32')")
>>>
>>> memoryview(x)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: type is not supported by the buffer protocol The use case is not an array that represents a single utf16 string, but So x would be exported with format 'u' and y with format 'w'. |
Just to demonstrate what the format would look like, this is working >>> x = xnd([b"123", b"23456"], dtype="fixed_bytes(size=10)")
>>> memoryview(x).format
'10s' So the formats in the previous message would be '10u' and '10w'. |
array('u') is not tied with the legacy Unicode C API. It is possible to use the modern wchar_t based Unicode C API for it. See bpo-36346. There are benefits from getting rid of the legacy Unicode C API, but not from array('u'). |
The funny thing is that array() already knows this: >>> import array
>>> a = array.array("u", "123")
>>> memoryview(a).format
'w' |
Even though this has been deprecated in the docs since 3.3, it doesn't seem to raise a |
Please see PR #95760 to emit a |
@methane Would you be able to look into this? It would be good to have the replacement ready when we start emitting deprecation warnings. |
The 3.12 beta feature freeze is in a week, so we will likely need to target changing this in 3.13 with removal in 3.15. |
How about:
Is there a reason to rush this? |
On the other hand, I don't hurry about removing it. My plan is:
|
@methane added @methane: Would you mind to also document the addition with |
Let's close this issue and come back to this in four years. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: