[Python-Dev] Let's update CObject API so it is safe and regular!

Hrvoje Niksic hrvoje.niksic at avl.com
Fri Apr 3 09:59:24 CEST 2009


Larry Hastings wrote:
>> If we're adding type information, then please make it a Python object 
>> rather than a C string.  That way the creator and the consumer can use 
>> a richer API to query the "type", such as by calling its methods or by 
>> inspecting it in some other way.
> 
> I'm not writing my patch that way; it would be too cumbersome for what 
> is ostensibly an easy, light-weight API.   If you're going that route
 > you might as well create a real PyTypeObject for the blob you're
 > passing in.

Well, that's exactly the point, given a PyObject* tag, you can add any 
kind of type identification you need, including some Python type.  (It 
is assumed that the actual pointer you're passing is not a PyObject 
itself, of course, otherwise you wouldn't need PyCObject at all.)

I have no desire to compete with your patch, it was a suggestion for 
(what I see as) improvement.


More information about the Python-Dev mailing list