[New-bugs-announce] [issue46585] Should we re-export `PyObj_FromPtr` in `ctypes`?

Nikita Sobolev report at bugs.python.org
Sun Jan 30 10:03:49 EST 2022

New submission from Nikita Sobolev <mail at sobolevn.me>:

After looking at https://github.com/python/cpython/blame/8fb36494501aad5b0c1d34311c9743c60bb9926c/Lib/ctypes/test/test_python_api.py#L5-L10 in https://bugs.python.org/issue46584

it seems that we should address this comment:

# This section should be moved into ctypes\__init__.py, when it's ready.

from _ctypes import PyObj_FromPtr

by either:
1. Making `PyObj_FromPtr` public by re-exporting it from `ctypes`
2. Removing this comment

Arguments for `(1)`:
- It is quite widely used and there are a lot of articles mentioning it: https://www.programcreek.com/python/example/77012/_ctypes.PyObj_FromPtr and https://programtalk.com/python-examples/_ctypes.PyObj_FromPtr/ Basically, Google is filled with results.
- It looks useful for educational purposes.

I don't think that I am familiar with `ctypes`'s history well enough to make an educated dicision here.

But, I would love to work on this after this decision is made :)

components: ctypes
messages: 412155
nosy: amaury.forgeotdarc, belopolsky, meador.inge, sobolevn, zach.ware
priority: normal
severity: normal
status: open
title: Should we re-export `PyObj_FromPtr` in `ctypes`?
type: behavior
versions: Python 3.11

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list