[issue5630] Update CObject API so it is safe and regular

2009-04-02 Thread Larry Hastings
Larry Hastings added the comment: Having slept on it, I agree that we only need one API to create an object. Since passing in a "context" will be relatively rare, users who need that can use PyCObject_SetContext(). I'll remove PyCObject_FromVoidPtrWithContext() in my next patch. -- _

[issue5630] Update CObject API so it is safe and regular

2009-04-01 Thread Larry Hastings
Larry Hastings added the comment: Sorry, in editing I forgot to finish my sentence. In the middle of the second paragraph, the sentence should read: But 90% of the time all you'll need is PyCObject_FromVoidPtr(). My other editing mistakes will just have to stand. --

[issue5630] Update CObject API so it is safe and regular

2009-04-01 Thread Larry Hastings
Larry Hastings added the comment: dalcinl: I made the destructor the first argument because APIs where arguments move around irritate me. In the existing CObject API, the destructor is "always" the last argument--which means in practice it is either the second or third argument, depending on w

[issue5630] Update CObject API so it is safe and regular

2009-03-31 Thread Daniel Diniz
Changes by Daniel Diniz : -- nosy: +ajaksu2 type: -> feature request ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue5630] Update CObject API so it is safe and regular

2009-03-31 Thread Lisandro Dalcin
Lisandro Dalcin added the comment: Two questions: 1) Why do you prefer to pass destructor as a first argument? 2) Do we really need two different calls for providing a context pointer? Why no just one call and pass a NULL context? A comment: Suppose one wants to implement export/import modul

[issue5630] Update CObject API so it is safe and regular

2009-03-31 Thread Larry Hastings
New submission from Larry Hastings : The CObject API has two flaws. First, there is no usable type safety mechanism. You can store a void *object, and a void *description. There is no established schema for the description; it could be an integer cast to a pointer, or it could point to memory