classification
Title: collections.deque.__contains__ and .count should hold strong references.
Type: crash Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Dennis Sweeney, rhettinger
Priority: normal Keywords: patch

Created on 2020-02-09 05:02 by Dennis Sweeney, last changed 2020-02-09 08:39 by rhettinger. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18421 merged Dennis Sweeney, 2020-02-09 05:48
PR 18423 merged miss-islington, 2020-02-09 08:17
Messages (4)
msg361642 - (view) Author: Dennis Sweeney (Dennis Sweeney) * Date: 2020-02-09 05:02
Similar to https://bugs.python.org/issue39453, but with deques:

Python 3.9.0a3+:

>>> from collections import deque
>>> class A:
...     def __eq__(self, other):
...         L.clear()
...         return NotImplemented
...
>>> L = [A(), A(), A()]
>>> 17 in L
False
>>> L = deque([A(), A(), A()])
>>> 17 in L

(Crashes with "Unhandled exception thrown: read access violation.")
msg361644 - (view) Author: Dennis Sweeney (Dennis Sweeney) * Date: 2020-02-09 05:57
Should there be a similar generic test case in test.seq_test?
msg361647 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-02-09 08:16
New changeset c6dedde160a9fce5d049e860f586ad8f93aec822 by sweeneyde in branch 'master':
bpo-39590: make deque.__contains__ and deque.count hold strong references (GH-18421)
https://github.com/python/cpython/commit/c6dedde160a9fce5d049e860f586ad8f93aec822
msg361648 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-02-09 08:39
New changeset dc56f5f48866bf3c5412642bba00890d9a090cfb by Miss Islington (bot) in branch '3.8':
bpo-39590: make deque.__contains__ and deque.count hold strong references (GH-18421) (GH-18423)
https://github.com/python/cpython/commit/dc56f5f48866bf3c5412642bba00890d9a090cfb
History
Date User Action Args
2020-02-09 08:39:39rhettingersetmessages: + msg361648
2020-02-09 08:17:34rhettingersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-02-09 08:17:08miss-islingtonsetpull_requests: + pull_request17800
2020-02-09 08:16:56rhettingersetnosy: + rhettinger
messages: + msg361647
2020-02-09 05:57:11Dennis Sweeneysetmessages: + msg361644
2020-02-09 05:48:49Dennis Sweeneysetkeywords: + patch
stage: patch review
pull_requests: + pull_request17796
2020-02-09 05:02:53Dennis Sweeneycreate