
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2019-08-06 06:57 byjoernheissler, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 15170 | merged | shireenrao,2019-08-07 22:49 | |
| PR 15461 | merged | miss-islington,2019-08-24 15:30 | |
| Messages (7) | |||
|---|---|---|---|
| msg349101 -(view) | Author: Jörn Heissler (joernheissler)* | Date: 2019-08-06 06:57 | |
Hello,#!/usr/bin/python3.8from zipfile import ZipFile, Pathimport iodef recurse_print(parent): for child in parent.iterdir(): if child.is_file(): print(child, child.read_text()) if child.is_dir(): recurse_print(child)data = io.BytesIO()zf = ZipFile(data, "w")zf.writestr("a.txt", "content of a")zf.writestr("b/c.txt", "content of c")zf.writestr("b/d/e.txt", "content of e")zf.writestr("b/f.txt", "content of f")zf.filename = "abcde.zip"root = Path(zf)recurse_print(root)Expected result:abcde.zip/a.txt content of aabcde.zip/b/c.txt content of cabcde.zip/b/f.txt content of fabcde.zip/b/d/e.txt content of eActual result:abcde.zip/a.txt content of aabcde.zip/b/c.txt content of cabcde.zip/b/f.txt content of fabcde.zip/b/d/e.txt content of eabcde.zip/b/c.txt content of cabcde.zip/b/f.txt content of fabcde.zip/b/d/e.txt content of ePath._add_implied_dirs adds the sub directory "b/" twice: once for each direct child (i.e. "c.txt" and "f.txt")And similarly:data = io.BytesIO()zf = ZipFile(data, "w")zf.writestr("a.txt", "content of a")zf.writestr("b/d/e.txt", "content of e")zf.filename = "abcde.zip"root = Path(zf)recurse_print(root)Expected result:abcde.zip/a.txt content of aabcde.zip/b/d/e.txt content of eActual result:abcde.zip/a.txt content of aHere, Path._add_implied_dirs doesn't add "b/" at all, because there are no direct childs of "b". | |||
| msg349150 -(view) | Author: Srinivas Nyayapati (shireenrao)* | Date: 2019-08-07 04:25 | |
I have attempted a fix to Path._add_implied_dirs and have the changes in my github branchhttps://github.com/shireenrao/cpython/tree/zipfile. Is it ok if I submitted a PR on this? I have run test_zipfile.py and the test case provided by Jörn Heissler successfully. | |||
| msg349201 -(view) | Author: Jason R. Coombs (jaraco)*![]() | Date: 2019-08-07 21:12 | |
Please do. | |||
| msg349205 -(view) | Author: Srinivas Nyayapati (shireenrao)* | Date: 2019-08-08 00:08 | |
I just submitted my PR. | |||
| msg350374 -(view) | Author: Jason R. Coombs (jaraco)*![]() | Date: 2019-08-24 15:26 | |
New changeseta4e2991bdc993b60b6457c8a38d6e4a1fc845781 by Jason R. Coombs (shireenrao) in branch 'master':bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170)https://github.com/python/cpython/commit/a4e2991bdc993b60b6457c8a38d6e4a1fc845781 | |||
| msg350375 -(view) | Author: Jason R. Coombs (jaraco)*![]() | Date: 2019-08-24 16:03 | |
New changesetc410f381bf66c48d84812e19e3ba7c2878511a3e by Jason R. Coombs (Miss Islington (bot)) in branch '3.8':bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170) (#15461)https://github.com/python/cpython/commit/c410f381bf66c48d84812e19e3ba7c2878511a3e | |||
| msg350376 -(view) | Author: Jason R. Coombs (jaraco)*![]() | Date: 2019-08-24 16:28 | |
Thanks very much shireenrao for the PR, which is now merged with Python 3.8+. I've additionally backported the fix to zipp in 0.6.0. | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:18 | admin | set | github: 81953 |
| 2019-08-24 16:28:26 | jaraco | set | status: open -> closed versions: + Python 3.8 messages: +msg350376 resolution: fixed stage: patch review -> resolved |
| 2019-08-24 16:03:55 | jaraco | set | messages: +msg350375 |
| 2019-08-24 15:30:25 | miss-islington | set | pull_requests: +pull_request15155 |
| 2019-08-24 15:26:44 | jaraco | set | messages: +msg350374 |
| 2019-08-08 00:08:16 | shireenrao | set | messages: +msg349205 |
| 2019-08-07 22:49:26 | shireenrao | set | keywords: +patch stage: patch review pull_requests: +pull_request14902 |
| 2019-08-07 21:13:53 | jaraco | set | assignee:jaraco |
| 2019-08-07 21:12:45 | jaraco | set | messages: +msg349201 |
| 2019-08-07 04:25:14 | shireenrao | set | nosy: +shireenrao messages: +msg349150 |
| 2019-08-06 21:03:21 | brett.cannon | set | nosy: +jaraco |
| 2019-08-06 06:57:30 | joernheissler | create | |