-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
sys.maxunicode value after PEP-393 #57263
Comments
Now that PEP-393 is in and the distinction between narrow and wide doesn't exist anymore, the value of sys.maxunicode should always be 0x10FFFF. sys.maxunicode currently uses PyUnicode_GetMax (Objects/unicodeobject.c:196) and still returns either 0x10FFFF if Py_UNICODE_WIDE is defined or 0xFFFF if it's not (and that should now mean that it's defined on Linux where wchar_t is 4 bytes, but not on Windows where it's 2 bytes (isn't this backward incompatible? if so it probably deserves another issue)). IIUC the difference between narrow and wide is gone for Python users, but it's still there for C users that use the old API, so changing PyUnicode_GetMax will most likely break their code. I therefore suggest to set sys.maxunicode to 0x10FFFF and to leave PyUnicode_GetMax as is. C users that switch to the new API should stop using PyUnicode_GetMax and it should be added along with the other deprecated functions in PEP-393. |
Attached initial patch that sets the value of sys.maxunicode to 0x10FFFF, adds a test, and document the change in both the sys.rst doc and in the 3.3 whatsnew. The patch doesn't include any deprecation. If we decide to deprecate something the PEP and possibly the code should be updated. |
Sounds all fine to me. As the PEP specifies, all deprecation will only be on paper for now, not in the code. Adding PyUnicode_GetMax to the list sounds fine to me as well. |
New changeset 606652491366 by Ezio Melotti in branch 'default': |
Attached a second patch that fixes checks like: There are a couple of places (e.g. test_bigmem) where I'm not sure what the best fix is, so I added a couple of XXX in the patch. If you have any suggestion please comment either here on in the review page. |
I added PyUnicode_GetMax to the list of deprecated functions in PEP-393 in http://hg.python.org/peps/rev/9a154edf18e6. |
As said on IRC, unicodesize and character_size should be 1 before the test is something like 'x'*1. Or you can just remove this constant, it's not very useful to have a constant equal to 1 :-) |
I think there's no point in deprecating a function (or data) with a perfectly valid definition. |
New changeset f39b26ca7f3d by Ezio Melotti in branch 'default': |
The buildbot seems happy, so I'm closing this. |
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:
The text was updated successfully, but these errors were encountered: