[issue45082] ctypes: Deprecate c_buffer() alias to create_string_buffer()
STINNER Victor
report at bugs.python.org
Wed Sep 1 17:30:22 EDT 2021
New submission from STINNER Victor <vstinner at python.org>:
Since the ctypes module was added to the stdlib (commit babddfca758abe34ff12023f63b18d745fae7ca9 in 2006), ctypes.c_buffer() was an alias to ctypes.create_string_buffer(). The implementation contains a commented deprecation:
def c_buffer(init, size=None):
## "deprecated, use create_string_buffer instead"
## import warnings
## warnings.warn("c_buffer is deprecated, use create_string_buffer instead",
## DeprecationWarning, stacklevel=2)
return create_string_buffer(init, size)
I propose to start to deprecate ctypes.c_buffer(): use ctypes.create_string_buffer() directly.
In older ctypes version, the function was called c_string(): it's still mentioned in the ctypes documentation. This legacy is confusion, and it's time to simplify the API to provide a single function.
----------
components: ctypes
messages: 400871
nosy: vstinner
priority: normal
severity: normal
status: open
title: ctypes: Deprecate c_buffer() alias to create_string_buffer()
versions: Python 3.11
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45082>
_______________________________________
More information about the Python-bugs-list
mailing list