[docs] [issue36203] PyWeakref_NewRef docs are misleading

Windson Yang report at bugs.python.org
Wed Mar 6 06:32:12 EST 2019


Windson Yang <wiwindson at outlook.com> added the comment:

Yes, Maxwell. I guess the docs are misleading, the code locate in https://github.com/python/cpython/blob/master/Objects/weakrefobject.c#L748

if (callback == Py_None)
        callback = NULL;
    if (callback == NULL)
        /* return existing weak reference if it exists */
        result = ref;
    if (result != NULL)
        Py_INCREF(result);
    else {
        ...
    }

However, I'm not sure we should fix the docs or the code here.

----------
nosy: +Windson Yang

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36203>
_______________________________________


More information about the docs mailing list