[issue17042] Example in C-API memory management doc has confusing order

2013-01-26 Thread Eric Snow
Eric Snow added the comment: Sorry, I'd meant something like this: char *buf1 = PyMem_New(char, BUFSIZ); char *buf2 = (char *) malloc(BUFSIZ); char *buf3 = (char *) PyMem_Malloc(BUFSIZ); ... /* in reverse order */ PyMem_Del(buf3); /* Wron

[issue17042] Example in C-API memory management doc has confusing order

2013-01-26 Thread Stefan Krah
Stefan Krah added the comment: Moderately opposed, yes. PyMem_Malloc()/PyMem_Free() and PyMem_New()/PyMem_Del() are already explained in depth above. -- ___ Python tracker ___ __

[issue17042] Example in C-API memory management doc has confusing order

2013-01-26 Thread Eric Snow
Eric Snow added the comment: Thanks for clarifying, Stefan. Are you opposed to a comment in the example? -- ___ Python tracker ___ __

[issue17042] Example in C-API memory management doc has confusing order

2013-01-26 Thread Ezio Melotti
Changes by Ezio Melotti : -- resolution: -> rejected stage: needs patch -> committed/rejected status: open -> closed type: -> enhancement ___ Python tracker ___ ___

[issue17042] Example in C-API memory management doc has confusing order

2013-01-26 Thread Stefan Krah
Stefan Krah added the comment: Please don't change this: It's a common pattern in C to undo memory allocations in the opposite order. -- nosy: +skrah ___ Python tracker ___ _

[issue17042] Example in C-API memory management doc has confusing order

2013-01-26 Thread Eric Snow
New submission from Eric Snow: In http://docs.python.org/dev/c-api/memory.html#examples: char *buf1 = PyMem_New(char, BUFSIZ); char *buf2 = (char *) malloc(BUFSIZ); char *buf3 = (char *) PyMem_Malloc(BUFSIZ); ... PyMem_Del(buf3); /* Wrong