On Tue, 18 Sep 2001, Skip Montanaro wrote:

>
>     James> Although the current code was non broken before, there is a patch
>     James> under consideration that would make the GTypes store a munged
>     James> pointer, which is not really safe to store in a python int (there
>     James> may be size issues, etc).
>
> James,
>
> Take a look at PyLong_FromVoidPtr and PyLong_AsVoidPtr.  I'm not sure they
> are documented in the Python C API reference, but it sounds like what you
> really should be using to hide pointers.

There are very few number operations it makes sense to use with GTypes.
Performing addition and other operators will most likely yield an invalid
type id, and using it could cause a segfault.

Always representing GTypes by a special object type in python also has its
advantages.  I could make things like str(gtype) give the type name, etc.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to