Content-Length: 293796 | pFad | https://github.com/python/cpython/issues/121749

29 Discrepancy in docs for `PyModule_AddObjectRef` · Issue #121749 · python/cpython · GitHub
Skip to content

Discrepancy in docs for PyModule_AddObjectRef #121749

@tomasr8

Description

@tomasr8

Bug report

Bug description:

The docs for PyModule_AddObjectRef say:

Return ``NULL`` if *value* is ``NULL``. It must be called with an exception
raised in this case.

However the function actually returns -1 in that case:

cpython/Python/modsupport.c

Lines 590 to 597 in cae1526

if (!value) {
if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_SystemError,
"PyModule_AddObjectRef() must be called "
"with an exception raised if value is NULL");
}
return -1;
}

We should update the documentation to reflect that.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/121749

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy