Issue 17765: weakref.ref ignores a 'callback' keyword argument (original ) (raw ) Issue17765
Created on 2013-04-16 19:11 by mark.dickinson , last changed 2022-04-11 14:57 by admin . This issue is now closed .
Messages (8)
msg187115 - (view)
Author: Mark Dickinson (mark.dickinson) *
Date: 2013-04-16 19:11
Passing a weakref.ref callback by keyword currently fails silently: Python 3.4.0a0 (default:537c1f1ab53c, Apr 16 2013, 20:07:47) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import weakref >>> weakref.ref({1, 2, 3}, callback=lambda ref:print("collected")) <weakref at 0x1006189d8; dead> For Python 3.4, I'd suggest that either (1) this should be an exception, or (2) it should be permissible to pass the callback by keyword.
msg199898 - (view)
Author: Georg Brandl (georg.brandl) *
Date: 2013-10-14 14:43
See attached patch, it handles this like all other builtins that don't support keyword arguments in their constructor.
msg199904 - (view)
Author: Antoine Pitrou (pitrou) *
Date: 2013-10-14 15:07
Why the PyWeakref_Check() in your patch?
msg199909 - (view)
Author: Georg Brandl (georg.brandl) *
Date: 2013-10-14 15:35
Good point, that is pointless in __init__().
msg264954 - (view)
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2016-05-06 09:40
no_weakref_kwargs_2.patch LGTM.
msg265056 - (view)
Author: Georg Brandl (georg.brandl) *
Date: 2016-05-07 09:41
Serhiy, feel free to go ahead and commit, I don't have my keys with me ATM.
msg265062 - (view)
Author: Roundup Robot (python-dev)
Date: 2016-05-07 12:44
New changeset ee17a83feabc by Serhiy Storchaka in branch '3.5': Issue #17765 : weakref.ref() no longer silently ignores keyword arguments. https://hg.python.org/cpython/rev/ee17a83feabc New changeset 60de9c6188cc by Serhiy Storchaka in branch '2.7': Issue #17765 : weakref.ref() no longer silently ignores keyword arguments. https://hg.python.org/cpython/rev/60de9c6188cc New changeset ef55fa8c4b82 by Serhiy Storchaka in branch 'default': Issue #17765 : weakref.ref() no longer silently ignores keyword arguments. https://hg.python.org/cpython/rev/ef55fa8c4b82
msg265063 - (view)
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2016-05-07 12:47
Done. This issue is similar to recently closed . Please give me know if you have other ready to review patches.
History
Date
User
Action
Args
2022-04-11 14:57:44
admin
set
github: 61965
2016-05-07 12:48:00
serhiy.storchaka
set
status: open -> closedresolution: fixedmessages: + stage: commit review -> resolved
2016-05-07 12:44:33
python-dev
set
nosy: + python-dev messages: +
2016-05-07 09:41:05
georg.brandl
set
messages: +
2016-05-07 05:51:24
serhiy.storchaka
set
assignee: georg.brandl
2016-05-06 09:40:28
serhiy.storchaka
set
type: enhancement -> behaviorcomponents: + Extension Modulesversions: + Python 3.5, Python 3.6, - Python 3.3, Python 3.4nosy: + serhiy.storchaka messages: + stage: needs patch -> commit review
2013-10-14 15:37:24
georg.brandl
set
files: + no_weakref_kwargs_2.patch
2013-10-14 15:35:20
georg.brandl
set
messages: +
2013-10-14 15:07:19
pitrou
set
messages: +
2013-10-14 14:43:54
georg.brandl
set
files: + no_weakref_kwargs.patch versions: + Python 2.7, Python 3.3nosy: + georg.brandl , pitrou messages: + keywords: + patch
2013-04-16 19:11:10
mark.dickinson
create