homepage

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: "Extending Python with C" page needs update for 3.x
Type: Stage: patch review
Components: Documentation Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, eli.bendersky, jcea, python-dev, sandro.tosi
Priority: normal Keywords:

Created on 2012年08月14日 18:57 by sandro.tosi, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (5)
msg168223 - (view) Author: Sandro Tosi (sandro.tosi) * (Python committer) Date: 2012年08月14日 18:57
Hello,
this has been reported at http://mail.python.org/pipermail/docs/2012-July/009223.html but since I have no experience to judge if it's correct or not, i'll just report it:
>>>
I've recenty started to try using C code in python using the wonderful
python API, although i have to say the learning curve was non neglectable :P
I've spotted what I believe to be a small mistake in the documentation
from this page:
http://docs.python.org/release/3.2/extending/extending.html
In paragraph 1.8
(http://docs.python.org/release/3.2/extending/extending.html#keyword-parameters-for-extension-functions),
the code example given contains an error, which is actually obsolete
code from python 2.7:
void
initkeywdarg(void)
{
 /* Create the module and add the functions */
 Py_InitModule("keywdarg", keywdarg_methods);
}
This doesn't work in Python3.2. It's supposed to be
static struct PyModuleDef keywdargmodule = {
 PyModuleDef_HEAD_INIT,
 "keywdarg", /* name of module */
 keywdarg_doc, /* module documentation, may be NULL */
 -1, /* size of per-interpreter state of the module,
 or -1 if the module keeps state in global variables. */
 keywdarg_methods
};
PyMODINIT_FUNC
PyInit_keywdarg(void)
{
 return PyModule_Create(&keywdargmodule);
}
As explained above (and confirmed by experience).
<<<
msg168283 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年08月15日 11:52
New changeset 599376deeeac by Eli Bendersky in branch '3.2':
Issue #15656: fixing code sample in extending doc
http://hg.python.org/cpython/rev/599376deeeac 
msg168284 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2012年08月15日 11:53
Fixed, thanks for the report.
msg168319 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2012年08月15日 19:35
Should this be applied to "default" (3.3) too?
msg168321 - (view) Author: Sandro Tosi (sandro.tosi) * (Python committer) Date: 2012年08月15日 19:40
It's fixed in default too: http://hg.python.org/cpython/rev/f46b4b7b817c
It was not shown because the commit message misses the issue reference.
History
Date User Action Args
2022年04月11日 14:57:34adminsetgithub: 59861
2012年08月15日 19:40:16sandro.tosisetmessages: + msg168321
2012年08月15日 19:35:51jceasetmessages: + msg168319
2012年08月15日 19:34:15jceasetnosy: + jcea
2012年08月15日 11:53:24eli.benderskysetstatus: open -> closed
resolution: fixed
messages: + msg168284
2012年08月15日 11:52:27python-devsetnosy: + python-dev
messages: + msg168283
2012年08月15日 11:41:31eli.benderskysetnosy: + eli.bendersky
2012年08月14日 18:57:45sandro.tosicreate

AltStyle によって変換されたページ (->オリジナル) /