Vladimir Marangozov wrote: > The goal is to remove Python's dependency on the standard POSIX = interface > (malloc/realloc/free) so that we can cleanly and easily plug in the = future > a "proprietary" mem manager, other than the one in the C library. (hmm. I've been forced to use interfaces like this a lot, but never ever stumbled upon a situation where we couldn't just tweak malloc/free to mean what we wanted, either by relinking or via the preprocessor. I'm sceptical, in other words...) > For this purpose, the Python core should be patched and "cleaned" to = use > one or more of the following APIs: >=20 > 1) PyMem_MALLOC 2) PyMem_NEW =20 > PyMem_REALLOC =3D=3D> PyMem_RESIZE > PyMem_FREE PyMem_DEL > PyMem_XDEL is XDEL simply a "if (p) free(p)" variant? if so, don't forget that ANSI C requires that free() does the right thing if handled a NULL pointer. since Python 1.6 will be ANSI C, it's probably better to force users of broken platforms to work around bugs in PyMem_FREE, rather than expose two different alternatives. I'm pretty sure there are standard macros for auto- conf that tests for this. in other words,=20 > > ! if (md->off_num) free(md->off_num);=20 > > ! if (md->offset_top) free(md->offset_top);=20 > > ! if (md->r1) free(md->r1);=20 > > ! if (md->r2) free(md->r2);=20 > > ! if (md->eptr) free((char *)md->eptr);=20 > > ! if (md->ecode) free((char *)md->ecode); would become: > > ! PyMem_FREE(md->off_num);=20 > > ! PyMem_FREE(md->offset_top);=20 > > ! PyMem_FREE(md->r1);=20 > > ! PyMem_FREE(md->r2);=20 > > ! PyMem_FREE(md->eptr);=20 > > ! PyMem_FREE(md->ecode); </F>
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