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

Maciej Fijalkowski fijall at gmail.com
Mon Nov 5 14:38:23 CET 2012


On Mon, Nov 5, 2012 at 9:31 AM, 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?
>
> 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)
> 4. eating your own dogfood helps to make modules complete and notice
> such silly/critical/timewasting/drivesmemad errors as
> http://bugs.python.org/issue16376 a few years earlier
>
> Maybe it could even help to make ctypes faster (through some caching mechanizm).
> --
> anatoly t.
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fijall%40gmail.com

Hi anatoly.

ctypes comes with it's own set of problems that manifest themselves
more or less depending what sort of libary have you tried to wrap.
Have you ever tried to use it seriously? The list of my personal
issues is available here:
http://morepypy.blogspot.com/2012/06/release-01-of-cffi.html

The main problem is API vs ABI and the robustness of checks.

I would not recommend using ctypes for any of the sdtlib (we actually
tried in pypy, it turned out a bit awful).

Cheers,
fijal


More information about the Python-Dev mailing list