[Greg Ewing] > However, if they're not exclusively for objects, > having "Object" in the name would seem to be > highly confusing, perhaps dangerously so. (Person > A writes PyObject_Alloc(some_chars), Person B > writing the code to free it thinks "What??? > That can't be right!" and uses PyMem_Free.) Given that it's been this way since the PyObject_ memory family was introduced, and a real Person B hasn't posted to complain about being led into temptation yet, sorry, I don't take this argument seriously. The comments in objimpl.h tell the truth, and it's really quite simple: For allocating objects, use PyObject_{New, NewVar} instead whenever possible. The PyObject_{Malloc, Realloc, Free} family is exposed so that you can exploit Python's small-block allocator for non-object uses. If you must use these routines to allocate object memory, make sure the object gets initialized via PyObject_{Init, InitVar} after obtaining the raw memory.
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