Re: [Python-Dev] Memoryviews should expose the underlying memory address

2012年9月20日 16:18:05 -0700

Le Sep 20, 2012 à 11:35 AM, David Beazley <[email protected]> a écrit :
> Well, if it's supposed to do that, it certainly doesn't work for me in 3.3. 
> I get a type error about it wanting a ctypes pointer object. Even if this 
> worked, it still doesn't address the need to get the pointer value possibly 
> for some other purpose such as handling it off to a bunch of code generated 
> via LLVM. 
It seems like there's no reason to need to get the pointer value out as a 
Python integer. If you are trying to get a pointer from a memoryview into some 
C code, or into some LLVM generated code, you still need to do the Python int 
object → C integer-of-some-kind → C pointer type conversion. Better to just go 
straight from Python memoryview object → C pointer in one supported API call. 
Isn't this what the y* w* s* format codes are for?
Every time I have something that's a big number and I need to turn it into a 
pointer, I have to stare at the table in 
<http://en.wikipedia.org/wiki/64_bit#64-bit_data_models> for like 30 seconds. 
I'd rather have some Python API do the staring for me. David, I realize that 
table is probably permanently visible in the heads-up display that your 
cybernetic implants afford you, but some of us need to make our way through C 
code with humbler faculties ;-).
-g
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to