This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Clarification needed in C API arg parsing
Type: Stage: resolved
Components: Documentation Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, pitrou, python-dev, sandro.tosi
Priority: normal Keywords:

Created on 2011-10-31 10:42 by sandro.tosi, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg146687 - (view) Author: Sandro Tosi (sandro.tosi) * (Python committer) Date: 2011-10-31 10:42
Hello,
given I can't fully comprehend the user request (sent on docs@ as of http://mail.python.org/pipermail/docs/2011-September/005791.html), I'm just echoing it :

>>>
recently I embedded Python into one of my applications, which included
some string parsing.
In my opinion the doc page about parsing arguments
(http://docs.python.org/c-api/arg.html) is missing the information, that
you must not free the returned const char *, like e.g. said here
(http://docs.python.org/c-api/string.html#PyString_AsString).
It was quite confusing for my first, so I would suggest adding this tiny
bit of information.
<<<
msg146777 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-11-01 14:07
It's already in the 3.x docs (but not 2.x):

“Strings and buffers

These formats allow to access an object as a contiguous chunk of memory. You don’t have to provide raw storage for the returned unicode or bytes area. Also, you won’t have to release any memory yourself, except with the es, es#, et and et# formats.”

http://docs.python.org/dev/c-api/arg.html#strings-and-buffers
msg150446 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-01-01 22:43
New changeset b2b7104691c9 by Sandro Tosi in branch '2.7':
Issue #13302: backport part of 3ed28f28466f
http://hg.python.org/cpython/rev/b2b7104691c9
msg150447 - (view) Author: Sandro Tosi (sandro.tosi) * (Python committer) Date: 2012-01-01 22:44
Thanks Antoine for the pointer.
History
Date User Action Args
2022-04-11 14:57:23adminsetgithub: 57511
2012-01-01 22:44:21sandro.tosisetstatus: open -> closed
versions: - Python 3.2, Python 3.3
messages: + msg150447

resolution: fixed
stage: needs patch -> resolved
2012-01-01 22:43:01python-devsetnosy: + python-dev
messages: + msg150446
2011-11-01 14:07:10pitrousetnosy: + pitrou
messages: + msg146777
2011-10-31 10:42:43sandro.tosicreate