[issue35475] Docs do not show PyImport_AddModuleObject() returns a borrowed reference.

New submission from Eric Snow <ericsnowcurrently@gmail.com>: In the C-API documentation the entry for PyImport_AddModuleObject[1] does not indicate that it returns a borrowed reference. [1] https://docs.python.org/3/c-api/import.html#c.PyImport_AddModuleObject ---------- assignee: docs@python components: Documentation keywords: easy messages: 331716 nosy: docs@python, eric.snow priority: normal severity: normal stage: needs patch status: open title: Docs do not show PyImport_AddModuleObject() returns a borrowed reference. type: enhancement versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________

Aaqa Ishtyaq <aaqaishtyaq@gmail.com> added the comment: Hi, I want to work on this issue, but I'm confused about how to apply to PyImport_AddModuleObject. I was also going through c_annotations.py[1]. [1] https://github.com/python/cpython/blob/master/Doc/tools/extensions/c_annotat... ---------- nosy: +aaqaishtyaq _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________

Ammar Askar <ammar@ammaraskar.com> added the comment: A good place to start might be to search for a function that says it returns a borrowed reference in the source tree. For example, "PyImport_AddModule" says it returns a borrowed reference. In the search you'll find the relevant file here: https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170a... ---------- nosy: +ammar2 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________

Aaqa Ishtyaq <aaqaishtyaq@gmail.com> added the comment: I was going through the source code to understand what is going on, but I can't find any function that returns a borrowed reference for 'PyImport_AddModuleObject'. Also, should I need to familiar with these macros and how they work? https://docs.python.org/3/c-api/refcounting.html ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________

Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- assignee: docs@python -> serhiy.storchaka nosy: +serhiy.storchaka _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________

Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- keywords: +patch pull_requests: +10372 stage: needs patch -> patch review _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________

Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: Information about borrowed references is taken from Doc/data/refcounts.dat. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________

Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: New changeset bdabb0737c631835b246c9823852d20331243315 by Serhiy Storchaka in branch 'master': bpo-35475: Add more PyImport* functions in refcounts.dat. (GH-11142) https://github.com/python/cpython/commit/bdabb0737c631835b246c9823852d203312... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________

Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +10437 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________

Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +10438 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________

miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 605ef6e534f05925ff826f65518abf163ed3900a by Miss Islington (bot) in branch '3.7': bpo-35475: Add more PyImport* functions in refcounts.dat. (GH-11142) https://github.com/python/cpython/commit/605ef6e534f05925ff826f65518abf163ed... ---------- nosy: +miss-islington _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________

Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________

Ned Deily <nad@python.org> added the comment: New changeset 75f187478603de33c15f501a947207bfe8ba833f by Ned Deily (Miss Islington (bot)) in branch '3.6': bpo-35475: Add more PyImport* functions in refcounts.dat. (GH-11142) (GH-11199) https://github.com/python/cpython/commit/75f187478603de33c15f501a947207bfe8b... ---------- nosy: +ned.deily _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35475> _______________________________________
participants (6)
-
Aaqa Ishtyaq
-
Ammar Askar
-
Eric Snow
-
miss-islington
-
Ned Deily
-
Serhiy Storchaka