Conversation
…_OP_VERIFY They are libkcapi's own values and were never defined by the Linux kernel, which uses the value of ALG_SET_PUBKEY for ALG_SET_DRBG_ENTROPY. socket no longer re-exports them from _socket, and accessing them through socket emits a DeprecationWarning. Removal is slated for 3.21.
Documentation build overview
9 files changed ·
|
|
Would it make sense to
Happy to contribute another PR if that's out of scope for this one |
Deprecates
socket.ALG_SET_PUBKEY,ALG_OP_SIGNandALG_OP_VERIFYfor removal in 3.21, following encukou's +1 on the issue.None of the three is in mainline
include/uapi/linux/if_alg.h, so CPython always uses its own fallbacks fromModules/socketmodule.h(6, 2, 3). On Linux 5.10 and later, 6 isALG_SET_DRBG_ENTROPY.The change follows the pattern
astuses for its deprecated classes in 3.16:socket.pypops the three names afterfrom _socket import *and leaves them out ofsocket.__all__, sofrom socket import *stays silent.__getattr__returns the old value throughwarnings._deprecated(..., remove=(3, 21))._socketitself is unchanged, so_socket.ALG_SET_PUBKEYstill exists without a warning. I left the C side alone because_socketis private and the fallback defines go at removal time anyway. If you would rather_socketwarned too, a module__getattr__like the onezlibuses for__version__would do it, and I can add that.Docs: a
deprecated-removednote on theALG_*entry insocket.rst, What's New 3.16 "New deprecations", "Pending removal in Python 3.21", and aLibraryNEWS entry.Testing: the new
GeneralModuleTests.test_deprecated_alg_constantsis skipped where_socketlacks the constants, so it runs on Linux only. I built with--with-pydebugon macOS, whereAF_ALGdoes not exist, so I ran it with the three values set on_socketbefore importingsocket. It passes with the change, and without it fails onassertNotIn(name, socket.__all__)for all three../python.exe -m test test_socket test___all__passes (755 run, 261 skipped). Accessing the names warns at the caller's line:The docs build with
--nitpickyadds no warnings (check-warnings.py --fail-if-regression --fail-if-improvedpasses), and sphinx-lint and ruff are clean.