python / cpython

The Python programming language
https://www.python.org
Other
63.49k stars 30.41k forks source link

documentation and noddy*.c #48987

Closed ef9d465d-7135-4a33-8984-ed021e03e275 closed 15 years ago

ef9d465d-7135-4a33-8984-ed021e03e275 commented 15 years ago
BPO 4737
Nosy @birkenfeld, @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = 'https://github.com/birkenfeld' closed_at = created_at = labels = ['docs'] title = 'documentation and noddy*.c' updated_at = user = 'https://bugs.python.org/exe' ``` bugs.python.org fields: ```python activity = actor = 'benjamin.peterson' assignee = 'georg.brandl' closed = True closed_date = closer = 'benjamin.peterson' components = ['Demos and Tools', 'Documentation'] creation = creator = 'exe' dependencies = [] files = [] hgrepos = [] issue_num = 4737 keywords = [] message_count = 2.0 messages = ['78260', '78265'] nosy_count = 3.0 nosy_names = ['georg.brandl', 'exe', 'benjamin.peterson'] pr_nums = [] priority = 'normal' resolution = 'fixed' stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue4737' versions = ['Python 3.0', 'Python 3.1'] ```

ef9d465d-7135-4a33-8984-ed021e03e275 commented 15 years ago

Hello!

1) In http://docs.python.org/3.0/extending/extending.html we see: \========= Note that PyMODINIT_FUNC declares the function as void return type \=========

But thats not true, it's defined as PyObject*. I think this is outdated info in documentation.

2) In Doc/includes/noddy*.c assumed that PyMODINIT_FUNC returns nothing 
but this wrong. If you try "python3.1 -c 'import noddy'" you will see 
segfault. This patch will fix this problem:
--- ./noddy.c       2008-12-24 17:09:36.424870738 +0300
+++ ./noddy.c   2008-12-24 17:18:01.524869143 +0300
@@ -52,4 +52,6 @@

     Py_INCREF(&noddy_NoddyType);
     PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType);
+
+    return m;
 }

Other noddy*.c files are also requiring this patch.

benjaminp commented 15 years ago

Thanks for the report! Fixed in r67925.