A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2019-January/156048.html below:

[Python-Dev] ctypes: is it intentional that id() is the only way to get the address of an object?

[Python-Dev] ctypes: is it intentional that id() is the only way to get the address of an object? [Python-Dev] ctypes: is it intentional that id() is the only way to get the address of an object?Antoine Pitrou solipsis at pitrou.net
Thu Jan 17 05:37:13 EST 2019
On Thu, 17 Jan 2019 21:26:06 +1100
Steven D'Aprano <steve at pearwood.info> wrote:
> Disclaimer: I'm not a ctypes expert, so I might have this completely 
> wrong. If so, I apologise for the noise.
> 
> The id() function is documented as returning an abstract ID number. In 
> CPython, that happens to have been implemented as the address of the 
> object.
> 
> I understand that the only way to pass the address of an object to 
> ctypes is to use that id. Is that intentional?

Can you explain in detail what you're doing?
If you're calling a C API taking a PyObject*, it seems like you should
be using ctypes.py_object as argument type specifier.  Various examples
can be found with Google.

Regards

Antoine.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4