GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||
GeezerVison is showing github.com — gh-105733: Deprecate ctypes SetPointerType() and ARRAY() by vstinner · Pull Request #105734 · python/cpython Conversation
|
|
A code search on A code search on It seems like a very low number of projects will be affected by this change. cc @hugovk |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
bc0a349 to
0be4ba0
Compare
|
Thanks for the review @hugovk. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| def ARRAY(typ, len): | ||
| import warnings | ||
| warnings._deprecated("ctypes.ARRAY", remove=(3, 15)) | ||
| return typ * len |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Do you think there's a high expected maintenance overhead or security risk here?
Per PEP 387:
If the expected maintenance overhead and security risk of the deprecated behavior is small (e.g. an old function is reimplemented in terms of a new, more general one), it can stay indefinitely (or until the situation changes).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
it's not a big maintenance burden nor a securty issue, why do you ask?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I ask to see if there's a special reason for remove=(3, 15), or if it can be relaxed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
What do you propose? To postpone the removal to Python 3.16?
On PyPI top 8,000 projects (at 2024-03-16), I found only 2 projects using ctypes.ARRAY. I search for regex ctypes.ARRAY|\<ARRAY\> (and excluded unrelated lines).
It's about two lines:
astroid-3.1.0.tar.gz: astroid-3.1.0/tests/brain/test_ctypes.py: ctypes.ARRAY(3, 2)
pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/adb/bootloader.py: imgarray = ctypes.ARRAY(img_info, self.num_images)
Before the function was only deprecated with a comment:
# XXX Deprecated def ARRAY(typ, len): return typ * len
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'll propose to follow the part of PEP 387 I quoted above. Alternatively, since this does break known projects, to soft-deprecate instead.
But I plan to propose that in the beta period, right now I'm only gathering info. Thanks for the answer!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.