-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Make _Py_PackageContext of type "const char *" #72934
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
Comments
Currently _Py_PackageContext has type "char *". But it is either NULL or a pointer to internal readonly UTF-8 representation of Unicode object. Adding the const qualifier makes it clear that the data is immutable. I don't think this change will break third-party code. |
It technically could (if they're passing it to a function that takes a "char *"), but if they are and they can't change the affected function to take "const char *" instead, then that's an actual bug in the way they're using it. So +1 from me for explicitly declaring the immutability in 3.7+ - it will need a note in the What's New porting guide though. |
Added a What's New note. On GitHub I found only three projects (besides clones of CPython sources) that use _Py_PackageContext. They are not affected by this change. |
Ah, my apologies - for some reason I completely failed to notice the leading underscore until I saw you refer to this as a private variable in the What's New note. That means the note only needs to go in the NEWS file for the benefit of maintainers, rather than in the public porting notes. Sorry for overcomplicating things :) Aside from my confusion about this actually being a private interface, the patch looks good to me. |
New changeset d2dd6578aa16 by Serhiy Storchaka in branch 'default': |
Thanks Nick. |
Misc/NEWS
so that it is managed by towncrier #552Note: 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: