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: Provide a strict form of zip (PEP-618) requiring same length inputs
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brandtbucher Nosy List: SilentGhost, brandtbucher, cool-RR, gregory.p.smith, gvanrossum, miss-islington, pitrou, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2020-05-15 19:25 by gregory.p.smith, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 20118 merged gregory.p.smith, 2020-05-15 19:27
PR 20124 merged miss-islington, 2020-05-15 21:26
PR 20921 merged gvanrossum, 2020-06-17 14:53
PR 20961 merged cool-RR, 2020-06-18 11:46
PR 24109 merged brandtbucher, 2021-01-05 05:25
Messages (13)
msg368965 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2020-05-15 19:25
PEP 618 https://www.python.org/dev/peps/pep-0618 discussions are still on going.  This issue is being filed to track an implementation, assuming the PEP is accepted and one is decided upon.

I'm filing it now, as I can at least use the issue for documentation enhancements of the existing zip() behavior.
msg368977 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2020-05-15 21:26
New changeset 6a5d3ff67644af42b1a781be2eacb2e82913441c by Gregory P. Smith in branch 'master':
bpo-40636: Clarify the zip built-in docstring. (GH-20118)
https://github.com/python/cpython/commit/6a5d3ff67644af42b1a781be2eacb2e82913441c
msg368980 - (view) Author: miss-islington (miss-islington) Date: 2020-05-15 21:43
New changeset c3d025a86a60348f19551bd9921304c5db322531 by Miss Islington (bot) in branch '3.8':
bpo-40636: Clarify the zip built-in docstring. (GH-20118)
https://github.com/python/cpython/commit/c3d025a86a60348f19551bd9921304c5db322531
msg371870 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-19 10:17
New changeset 310f6aa7db8dd48952ed718111ce0f016b1c8ef9 by Guido van Rossum in branch 'master':
bpo-40636: PEP 618: add strict parameter to zip() (GH-20921)
https://github.com/python/cpython/commit/310f6aa7db8dd48952ed718111ce0f016b1c8ef9
msg371899 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-06-19 20:39
New changeset 59cf853332a82ce92875ea3dd6bba08e1305a288 by Ram Rachum in branch 'master':
bpo-40636: Documentation for zip-strict (#20961)
https://github.com/python/cpython/commit/59cf853332a82ce92875ea3dd6bba08e1305a288
msg372272 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2020-06-24 18:22
Ram, please fix the typo pointed out on github https://github.com/python/cpython/commit/59cf853332a82ce92875ea3dd6bba08e1305a288#r40044022
msg372300 - (view) Author: Ram Rachum (cool-RR) * Date: 2020-06-25 05:32
I'll fix that typo.
msg384239 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-01-02 21:11
Tests test_zip_pickle_stability and test_zip_pickle_strict_stability look excessively strict. Why did we need them if there are other pickle tests? They prevent implementing optimizations like in issue36694.
msg384243 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-01-02 22:45
That's fair.  How do other builtins validate their pickling implementation?

Since the pickling goes through __reduce__/__reduce_ex__ we could instead test that those methods return the expected results, that pickling roundtrips, and that unpickling those exact byte strings produces the expected value?
msg384310 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-01-04 09:38
For other types we do not have such strict tests. We just test that pickling roundtrips (it is already tested for zip() in other tests). There are few tests that unpickling some exact byte strings produces the expected value, but these tests are in pickletester.py, because they test the unpickling machinery. If unpickling of some type depends on some private constructor (like re._compile), that constructor can be tested separately.

So I think that these tests can be removed.
msg384338 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-01-04 17:51
Sounds good, go for it. I assume @brandtbucher won't mind.
msg384339 - (view) Author: Brandt Bucher (brandtbucher) * (Python committer) Date: 2021-01-04 18:04
Yep, fine by me. I can remove them later today (unless Serhiy beats me to it).
msg384370 - (view) Author: Brandt Bucher (brandtbucher) * (Python committer) Date: 2021-01-05 07:05
New changeset 27f9dafc2ba51864a9bc2fe5d6293eb4fd887bce by Brandt Bucher in branch 'master':
bpo-40636: Remove overly-strict zip pickling tests (GH-24109)
https://github.com/python/cpython/commit/27f9dafc2ba51864a9bc2fe5d6293eb4fd887bce
History
Date User Action Args
2022-04-11 14:59:31adminsetgithub: 84816
2021-01-05 07:05:37brandtbuchersetmessages: + msg384370
2021-01-05 05:25:32brandtbuchersetpull_requests: + pull_request22938
2021-01-04 18:04:36brandtbuchersetmessages: + msg384339
2021-01-04 17:51:36gvanrossumsetmessages: + msg384338
2021-01-04 09:38:14serhiy.storchakasetmessages: + msg384310
2021-01-02 22:45:50gvanrossumsetmessages: + msg384243
2021-01-02 22:04:59vstinnersetnosy: - vstinner
2021-01-02 21:11:43serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg384239
2020-06-25 05:32:59cool-RRsetmessages: + msg372300
2020-06-24 18:22:25SilentGhostsetnosy: + SilentGhost
messages: + msg372272
2020-06-24 17:15:46brandtbuchersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-06-19 20:39:30gvanrossumsetmessages: + msg371899
2020-06-19 10:17:28vstinnersetnosy: + vstinner
messages: + msg371870
2020-06-18 11:46:07cool-RRsetpull_requests: + pull_request20140
2020-06-17 14:53:56gvanrossumsetnosy: + gvanrossum
pull_requests: + pull_request20120
2020-06-17 14:52:09brandtbuchersetassignee: brandtbucher

nosy: + cool-RR
components: + Interpreter Core
versions: + Python 3.10, - Python 3.9
2020-06-17 14:51:12brandtbucherlinkissue40353 superseder
2020-05-15 21:43:33miss-islingtonsetmessages: + msg368980
2020-05-15 21:26:14miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request19429
2020-05-15 21:26:07gregory.p.smithsetmessages: + msg368977
2020-05-15 19:27:04gregory.p.smithsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request19422
2020-05-15 19:25:39gregory.p.smithcreate