-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
ctypes: Deprecate SetPointerType() and ARRAY() functions #105733
Comments
I disagree with the proposal. (And with taking one hour between a proposal and merge.) The plan to remove
(I'll note that this clarification got added a few days after this proposal, though.) The function is two lines long, and has tests. It has no maintenance overhead or additional security risk. I propose to restore it and soft-deprecate instead. Would you be OK with that, @vstinner? As for |
(anecdotally: at EuroPython I've seen a person use ARRAY in the REPL. This is not worth them re-learning how to make array types.) |
I didn't see any complain about the deprecation apart from you. I don't see the benefits of keeping two ways to create an array. PEP 20 says:
A code search on PyPI top 7,500 projects only finds 2 lines:
The first one is stupid, |
There are a bit more usages on GitHub: https://github.com/search?q=%2F%28%3F-i%29ctypes%5C.ARRAY%5C%28%2F&type=code (but some of them are CPython but I found a bit more normal usages that are not 7 years old) |
So it's PEP 20 against PEP 387, or your opinion against mine :( |
I would favor keeping ARRAY, since there is little maintenance cost involved and removing it would break at least some users. |
I personally like |
Oh right. Let's keep ARRAY(). But I would suggest to simply remove the deprecation in this case, no need to soft deprecate it if we keep it. |
I'm for soft deprectation, because it tells you which of the two ways to do it is the obvious one :) |
…ating it. (pythonGH-122281) Soft-deprecate ctypes.ARRAY, rather than hard-deprecating it. Partially reverts 2211454 (cherry picked from commit 3833d27) Co-authored-by: Petr Viktorin <encukou@gmail.com>
Closing since completed in #122281. |
…ating it. (pythonGH-122281) Soft-deprecate ctypes.ARRAY, rather than hard-deprecating it. Partially reverts 2211454
The ctypes module has two undocumented functions: SetPointerType() and ARRAY(). These functions are marked as
XXX Deprecated
, but only in comments.I propose to deprecate
ctypes.SetPointerType()
andctypes.ARRAY()
by emitting a DeprecationWarning warning.These functions are not documented and not used in Python, but there are tested.
Linked PRs
The text was updated successfully, but these errors were encountered: