[Python-Dev] ctypes is not an acceptable implementation strategy for modules in the standard library?

Ronald Oussoren ronaldoussoren at mac.com
Mon Nov 5 10:32:18 CET 2012


On 5 Nov, 2012, at 8:31, anatoly techtonik <techtonik at gmail.com> wrote:

> From http://bugs.python.org/issue16410
> Subj?
> 
> Aren't there any modules in stdlib that access system API through ctypes?

uuid uses ctypes to access platform APIs.
> 
> My arguments for ctypes:
> 1. doesn't require compilation
> 2. easier to maintain (no C/toolchain knowledge/ownership needed)
> 3. pure Python is impossible to exploit (unlike pure C)

That's not not quite true, python code that uses ctypes can still cause buffer overflows and the like when you aren't careful, and adds new failure modes (such as incorrect specification of a C function prototype in the Python code that calls that C function)

Ronald


More information about the Python-Dev mailing list