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.

classification
Title: Simplify __reduce__() of set and dict iterators.
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: kristjan.jonsson, pablogsal, rhettinger, serhiy.storchaka, sir-sigurd, vstinner
Priority: normal Keywords: patch

Created on 2018-09-04 04:13 by sir-sigurd, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 9050 merged sir-sigurd, 2018-09-04 04:15
Messages (7)
msg324550 - (view) Author: Sergey Fedoseev (sir-sigurd) * Date: 2018-09-04 04:13
Currently __reduce__() implementation of set and dict iterators saves items to list using next/PyList_Append(), it could be simplified by using PySequence_List().
msg324552 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2018-09-04 05:04
Also take a look at the other places that have similar logic.  I believe these all went in at the same time. See commit 31668b8f7a3efc7b17511bb08525b28e8ff5f23a
msg324554 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-09-04 05:12
Seems there is a bug in the dict iter code, leading to a crash when pickle non-initial items iterator. Would be nice to add tests similar to issue34574, and if the bug will be exposed, fix it.
msg324580 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2018-09-04 10:37
Interesting, I'll have a look when I'm back from vacation.

On Tue, 4 Sep 2018, 07:04 Raymond Hettinger, <report@bugs.python.org> wrote:

>
> Raymond Hettinger <raymond.hettinger@gmail.com> added the comment:
>
> Also take a look at the other places that have similar logic.  I believe
> these all went in at the same time. See commit
> 31668b8f7a3efc7b17511bb08525b28e8ff5f23a
>
> ----------
> nosy: +kristjan.jonsson, rhettinger
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue34573>
> _______________________________________
>
msg324782 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-09-07 18:38
Perhaps the bug was specific to OrderedDict itrerators. I'll try to write additional tests, and after that I'll merge PR 9050.
msg328105 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2018-10-20 00:43
New changeset 6395844e6adebc12c4eba1fb75c5e7c9c8b89f85 by Pablo Galindo (Sergey Fedoseev) in branch 'master':
bpo-34573: Simplify __reduce__() of set and dict iterators. (GH-9050)
https://github.com/python/cpython/commit/6395844e6adebc12c4eba1fb75c5e7c9c8b89f85
msg328107 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-20 00:44
Thanks Sergey Fedoseev!
History
Date User Action Args
2022-04-11 14:59:05adminsetgithub: 78754
2018-10-20 00:44:56vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg328107

resolution: fixed
stage: patch review -> resolved
2018-10-20 00:43:38pablogsalsetnosy: + pablogsal
messages: + msg328105
2018-09-07 18:38:08serhiy.storchakasetassignee: serhiy.storchaka
messages: + msg324782
2018-09-04 10:37:46kristjan.jonssonsetmessages: + msg324580
2018-09-04 05:12:49serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg324554
2018-09-04 05:04:47rhettingersetnosy: + rhettinger, kristjan.jonsson
messages: + msg324552
2018-09-04 04:15:16sir-sigurdsetkeywords: + patch
stage: patch review
pull_requests: + pull_request8512
2018-09-04 04:13:52sir-sigurdcreate