Understanding memory location of Python variables

Marko Rauhamaa marko at pacujo.net
Sun Jun 17 08:05:21 EDT 2018


Bart <bc at freeuk.com>:
> So, how /do/ you obtain the memory address of those values are
> located? For example, in order to pass it to some foreign C function
> that takes a void* parameter.

That is dependent on the Python implementation. CPython supports native
C and C++ extensions:

   <URL: https://docs.python.org/3/extending/index.html>

Here's the C API for extracting data out of strings:

   <URL: https://docs.python.org/3/c-api/unicode.html#unicode-objects>


Marko



More information about the Python-list mailing list