On Wed, Jan 5, 2022 at 3:17 PM Yonatan Zunger <zun...@gmail.com> wrote:
> Hey everyone. > > Quick sanity check: The ctypes docs > <https://docs.python.org/3.10/library/ctypes.html#ctypes._CData> refer to > _CData as a non-public class which is in the module, but _ctypes.c doesn't > actually export it > <https://github.com/python/cpython/blob/main/Modules/_ctypes/_ctypes.c#L5680>. > (I discovered this because it turns out that typeshed *is* referencing > _CData, e.g. in its type annotations for RawIOBase > <https://github.com/python/typeshed/blob/master/stdlib/_typeshed/__init__.pyi#L190> > ) > > Is this intended behavior in CPython (in which case the docs are a bit off > and typeshed has a bug), or is it unexpected to people on this list (in > which case it's an issue in _ctypes.c)? > typeshed is presumably referring to itself. It defines an interface for ctypes._CData in https://github.com/python/typeshed/blob/master/stdlib/ctypes/__init__.pyi#L82 The CPython ctypes docs *seem* reasonable to me. There is such a class. It is not public, so you cannot access ctypes._CData in any direct manner. That it gets called a class may be somewhat historical - its purpose is to provide a common interface. What code would ever actually care that it used class mechanisms as an internal implementation detail to do that? -gps > > Yonatan > _______________________________________________ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/7L6DNNI3MJ4UIM3C7A7KAIWHX562MRZL/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/ENKP334GO73ISSQ5XM5UWTOQYGTROK4E/ Code of Conduct: http://python.org/psf/codeofconduct/