[issue36203] PyWeakref_NewRef docs are misleading

Maxwell Bernstein report at bugs.python.org
Wed Mar 6 11:33:19 EST 2019


Maxwell Bernstein <tekk.nolagi at gmail.com> added the comment:

NewProxy checks if it's callable, so I suppose the code should be fixed.

On Wed, Mar 6, 2019, 03:32 Windson Yang <report at bugs.python.org> wrote:

>
> 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>
> _______________________________________
>

----------

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


More information about the Python-bugs-list mailing list