This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dubiousjim
Recipients arigo, dubiousjim, fdrake, larry, methane, pitrou, python-dev, serhiy.storchaka, tim.peters
Date 2017-08-02.14:08:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1501682894.45.0.576179354409.issue28427@psf.upfronthosting.co.za>
In-reply-to
Content
In response to Issue #7105, self._pending_removals was added to WeakValueDictionaries (and also WeakKeyDictionaries, but they're not relevant to what I'm about to discuss). This was in changesets 58194 to tip and 58195 to 3.1, back in Jan 2010. In those changesets, the implementation of WeakValueDictionary.setdefault acquired a check on self._pending_removals, but only after the key lookup had failed. (See lines starting 5.127 in both those changesets.)

In changeset 87778, in Dec 2013, this same patch was backported to 2.7.

More recently, in response to the issue discussed above (Issue #28427), similar checks were added to WeakValueDictionary.get, but now BEFORE the  key lookup. This was in changesets 105851 to 3.5, 105852 to 3.6, 105853 to tip, and 105854 to 2.7, in Dec 2016. Notably, in the last changeset, the check on self._pending_removals on WeakValueDictionary.setdefault is also moved to the top of the function, before the key lookup is attempted. This parallels the change being made to WeakValueDictionary.get.

However, that change to WeakValueDictionary.setdefault was only made to the 2.7 branch. If it's correct, then why wasn't the same also done for 3.5, 3.6, and tip?
History
Date User Action Args
2017-08-02 14:08:14dubiousjimsetrecipients: + dubiousjim, tim.peters, fdrake, arigo, pitrou, larry, methane, python-dev, serhiy.storchaka
2017-08-02 14:08:14dubiousjimsetmessageid: <1501682894.45.0.576179354409.issue28427@psf.upfronthosting.co.za>
2017-08-02 14:08:14dubiousjimlinkissue28427 messages
2017-08-02 14:08:13dubiousjimcreate