M.-A. Lemburg wrote: > What is considered the "right" approach for this ? Should Python > objects *always* be deallocated using one of PyObject_Del() and > PyObject_DEL() or is PyMem_DEL() usable as well ? PyMem_DEL should not be used since it could be using a different allocator then PyObject_New. > The reason I'm asking is that the mxDateTime objects I'm > deallocating are actually unreferenced objects on a > free list, so PyObject_Del() will probably bomb on them. Why would it bomb? It doesn't do anything special as far as I can tell except free memory. Vladimir went a bit overboard with the pre-processor, IMHO, so its a little hard to tell for certain. > Also, what should be done with failing constructors ? I usually > use PyMem_DEL() to prevent the deallocator from being called but > still free the allocated memory. Is that the correct approach ? PyObject_Del() doesn't call the deallocator function. Neil
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4