safer ctype? (was GUIs - A modest Proposal)
lkcl
luke.leighton at gmail.com
Sat Jun 12 12:55:45 EDT 2010
On Jun 12, 8:11 am, "Martin v. Loewis" <mar... at v.loewis.de> wrote:
> > Got me thinking, is it perhaps doable to have a 'safe' ctype that is
> > guaranteed to be in the stdlib? Perhaps crippling it in a sense that it
> > only allows a known set of functions to be called?
>
> In some sense, a C module wrapping a selected number of functions
> (like the win32 extensions) is exactly that.
>
> Notice that it's not (only) the functions itself, but also the
> parameters. It's absolutely easy to crash Python by calling a function
> through ctypes that expects a pointer, and you pass an integer. The
> machine code will dereference the pointer (trusting that it actually is
> one), and crash.
what's so bad about that? (this is a genuine, non-hostile, non-
rhetorical, non-sarcastic question).
(if the answer is "because you can't catch a segfault as a python
exception", then the question is repeated)
l.
More information about the Python-list
mailing list