> > I think format specifiers that require explicit memory management are > > so difficult to use that they must be avoided. I'd be in favour of > > extending the argtuple type to include additional slots for objects > > that go away when the tuple goes away. > > I don't understand that last comment. I was suggesting that the tuple passed to C API should not be of <type 'tuple'>, but of <type 'argtuple'>, which should have a method add_object(o), which puts a reference to o into the tuple. Then, whenever you want to return memory to the user, you create a string object whose contents is that memory, and you put a reference to the string into the argument tuple. The author of the C function then does not need to worry about memory management: the memory will be deallocated when the argument tuple is released. Unfortunately, that approach cannot be used for the existing conversion codes that return memory, since it is the extension's job to release the memory; changing that would break extensions which do properly release memory. Regards, Martin
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