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.
Created on 2015年11月23日 16:28 by brett.cannon, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| zipimport.patch | serhiy.storchaka, 2016年12月08日 19:46 | review | ||
| zipimport-2.patch | serhiy.storchaka, 2016年12月09日 12:34 | review | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 4023 | closed | barry, 2017年10月17日 20:43 | |
| PR 6809 | merged | serhiy.storchaka, 2018年05月14日 16:20 | |
| PR 9404 | merged | serhiy.storchaka, 2018年09月18日 19:56 | |
| PR 9406 | merged | serhiy.storchaka, 2018年09月18日 20:20 | |
| PR 4470 | Decorater, 2018年09月19日 07:21 | ||
| Messages (33) | |||
|---|---|---|---|
| msg255183 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2015年11月23日 16:28 | |
No one wants to work on zipimport, and yet it's full of bugs. It needs a rewrite so that it's more maintainable. An idea floated at PyCon 2015 was to writing the zip-reading code in C and to keep it as simple as possible -- e.g., don't worry about supporting comments, etc. -- and then write the rest of the code in importlib, making maintenance much easier. All of the various zipimport bugs should be made dependent on this issue as unless they are critical flaws I doubt they will get fixed without the rewrite. |
|||
| msg255198 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2015年11月23日 17:15 | |
FYI I'm at the early stage of rewriting zipimport in Python. |
|||
| msg255202 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2015年11月23日 17:23 | |
Are you writing it in such a way that it can be bootstspped in with importlib so the stslib can be loaded from it? |
|||
| msg255224 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2015年11月23日 20:41 | |
It was my intention. |
|||
| msg256161 - (view) | Author: Rose Ames (superluser) * | Date: 2015年12月09日 21:12 | |
Serhiy, how far along are you on this? I have a wip from this summer that I could finish over the holidays. |
|||
| msg256171 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2015年12月10日 08:40 | |
I were on very early stage, and stopped this work few weeks ago in favor of other issues. I would be glad to make a review of your work when you have finished it Rose. |
|||
| msg256207 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2015年12月11日 08:25 | |
Can you both publish your WIP work? |
|||
| msg257360 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2016年01月02日 20:29 | |
What are people's statuses on their various attempts? Since this is going to block my importlib.resources work I will do the work myself or work directly with someone in order to make sure this gets done. |
|||
| msg257609 - (view) | Author: Rose Ames (superluser) * | Date: 2016年01月06日 14:41 | |
Sorry for the late response. I didn't have much time over the holidays. I think I better let someone else take this one. |
|||
| msg282731 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年12月08日 19:46 | |
Here is preliminary translation of zipimport to Python. It is not frozen and imports other modules. I tried to keep the implementation close to C implementation. As a consequence, some raised exceptions look arbitrary. |
|||
| msg282776 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年12月09日 12:34 | |
Got rid of dependencies from os, stat and encodings. |
|||
| msg282777 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2016年12月09日 13:16 | |
> Here is preliminary translation of zipimport to Python. It is not frozen and imports other modules. Technically, will it be possible to freeze it? It seems useful to keep the ability to put the whole stdlib into a single ZIP. Using a ZIP is sometimes suggested to avoid fstat() on disk for example, to speedup Python startup. But I also understand that the C code is painful to maintain and update. Anyway, nice job Serhiy :-) |
|||
| msg282871 - (view) | Author: Gregory P. Smith (gregory.p.smith) * (Python committer) | Date: 2016年12月10日 20:14 | |
So long as this code block that imports os is avoided, I believe that this can be properly frozen: + if not isinstance(path, str): + import os + path = os.fsdecode(path) But it should be easy to avoid that code path when the standard library is a zip file. Otherwise it uses importlib (frozen), marshal (builtin), sys (builtin), time (builtin), and zlib [if present] (extension module). |
|||
| msg282876 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年12月10日 21:16 | |
> Technically, will it be possible to freeze it? I think yes. But I don't know how to do this. I hope on Brett's (or other import machinery expert) help. Since zipimporter constructor is called only with string path by import machinery, the os module is not imported at initialization stage. |
|||
| msg282938 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2016年12月11日 19:06 | |
And having a private copy of os.fsdecode() isn't difficult as os.fspath() is in posix and after that it's four lines that only need access to the sys module. |
|||
| msg283130 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2016年12月13日 17:51 | |
Just FYI, if this lands I will probably try to build off of it to make a pathlib-like zip module to eventually replace zipfile. So if there's any API design decisions that need to be made, it would be great if we try to keep the zip-specific bits separate and generic enough to work with in other future libraries. |
|||
| msg299705 - (view) | Author: Yaron de Leeuw (jarondl) * | Date: 2017年08月03日 13:04 | |
What is the status of this work? Is there anything I can do to help make this happen? |
|||
| msg304484 - (view) | Author: Barry A. Warsaw (barry) * (Python committer) | Date: 2017年10月16日 21:42 | |
I've landed here after chatting with @brett.cannon. I have a use case for this (making pex startup faster by bypassing pkg_resources) but I need to hack around the limitation of dlopen'ing .so's from zips. Our idea was to have a zipimport subclass which doesn't return None from `importlib.util.find_spec()` when it finds a .so, but instead dumps that into some safe directory, and then arranges for a loader that knows how to load that. It sure would be handy for this to be a zipimporter subclass. :) I think Serhiy's patch predates the move to GitHub, so it's not a branch/PR. I guess the next step would be to branchify the patch and then continue discussion over there. Depending on my availability, I might do that. |
|||
| msg304531 - (view) | Author: Barry A. Warsaw (barry) * (Python committer) | Date: 2017年10月17日 20:44 | |
I've ported the patch to a branch on GH. See PR 4023. I started from zipimport-2.patch. It doesn't work, but it will be easier to work on as a PR rather than a patch. Contributions welcome! Let's see if we can make this work. |
|||
| msg306556 - (view) | Author: Decorater (Decorater) * | Date: 2017年11月20日 15:37 | |
So, after reviewing this it started to make me rethink about the zipimport.py file. So my question is how would that file work if it is an pyc file in python37.zip or something just to zipimport other modules? There is got to be some sort of low level api that can zip import the zip importer then on the rewrite. Am I right? Maybe the best bet is to wait for bug reports on the C Code and fixup the C Code if possible so that way there is no conflicts like the ones I just questioned. |
|||
| msg306610 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2017年11月21日 01:45 | |
zipimport.py would be frozen just like importlib, so there's no bootstrapping issue if that's what you're asking. |
|||
| msg307524 - (view) | Author: Decorater (Decorater) * | Date: 2017年12月03日 20:57 | |
Alright, just wanted to make sure because I did not want to have something break when loading up the entire standard library from an zip file with it. |
|||
| msg316536 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年05月14日 16:37 | |
PR 6809 freezes zipimport.py, adds changes made in zipimport.c since writing the initial Python implementation, and fixes few bugs exposed in the frozen module. Seems Python now works with the zipped stdlib. |
|||
| msg321267 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年07月08日 07:42 | |
Could anybody please make a review? This is just a first step, we need to do it before making other steps: implementing more modern import API, supporting large ZIP files and ZIP files with comments, implementing loading binary extensions from ZIP files, etc. |
|||
| msg321289 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2018年07月08日 20:14 | |
I'm planning to review the PR at some point. On Sun, Jul 8, 2018, 00:42 Serhiy Storchaka, <report@bugs.python.org> wrote: > > Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: > > Could anybody please make a review? This is just a first step, we need to > do it before making other steps: implementing more modern import API, > supporting large ZIP files and ZIP files with comments, implementing > loading binary extensions from ZIP files, etc. > > ---------- > > _______________________________________ > Python tracker <report@bugs.python.org> > <https://bugs.python.org/issue25711> > _______________________________________ > |
|||
| msg323750 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年08月19日 10:30 | |
Fixed issues on Windows. |
|||
| msg324445 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2018年08月31日 21:56 | |
I think Serhiy's PR is basically done, so now the question is do we want to merge it in and drop the C code? ;) I obviously say yes because this is I/O-bound code and so the switch shouldn't be enough of a performance hit to warrant blocking the gain in maintainability long-term (especially if we try to clean the module up slowly). Barry, since I know you work with zip files a lot at work did you want to check to make sure perf won't be an issue for your use-case? |
|||
| msg324453 - (view) | Author: Barry A. Warsaw (barry) * (Python committer) | Date: 2018年09月01日 00:08 | |
Not sure if I'll have time before the core sprints to check the implementation with shiv, but I can give it a try then. Do you mind waiting until then? |
|||
| msg324456 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2018年09月01日 02:18 | |
I'm personally in no rush and I assume Serhiy isn't either with 3.8 cut-off quite a ways out, so I see no rush. |
|||
| msg325672 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年09月18日 19:22 | |
New changeset 79d1c2e6c9d1bc1cf41ec3041801ca1a2b9a995b by Serhiy Storchaka in branch 'master': bpo-25711: Rewrite zipimport in pure Python. (GH-6809) https://github.com/python/cpython/commit/79d1c2e6c9d1bc1cf41ec3041801ca1a2b9a995b |
|||
| msg325706 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年09月19日 06:28 | |
New changeset 9da3961f364da2a3ced740230b85ffb4309238d3 by Serhiy Storchaka in branch 'master': bpo-25711: Move _ZipImportResourceReader from importlib to zipimport. (GH-9406) https://github.com/python/cpython/commit/9da3961f364da2a3ced740230b85ffb4309238d3 |
|||
| msg325771 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年09月19日 14:43 | |
New changeset b2984ab9a7c458f8b7ed8978c0c95b109116895d by Serhiy Storchaka in branch 'master': bpo-25711: Remove outdated zipimport tests. (GH-9404) https://github.com/python/cpython/commit/b2984ab9a7c458f8b7ed8978c0c95b109116895d |
|||
| msg329294 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2018年11月05日 12:17 | |
Noticed this was still open when reviewing Elvis's zipimport patch for issue 34022. Given the Python implementation has been merged, should we close this as resolved, and open new issues for any further changes (performance or otherwise)? |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:24 | admin | set | github: 69897 |
| 2018年11月05日 13:48:52 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018年11月05日 12:17:08 | ncoghlan | set | nosy:
+ ncoghlan messages: + msg329294 |
| 2018年09月19日 14:43:39 | serhiy.storchaka | set | messages: + msg325771 |
| 2018年09月19日 07:21:25 | Decorater | set | pull_requests: + pull_request8832 |
| 2018年09月19日 06:28:11 | serhiy.storchaka | set | messages: + msg325706 |
| 2018年09月18日 20:20:02 | serhiy.storchaka | set | pull_requests: + pull_request8828 |
| 2018年09月18日 19:56:36 | serhiy.storchaka | set | pull_requests: + pull_request8827 |
| 2018年09月18日 19:22:35 | serhiy.storchaka | set | messages: + msg325672 |
| 2018年09月01日 02:18:36 | brett.cannon | set | messages: + msg324456 |
| 2018年09月01日 00:08:03 | barry | set | messages: + msg324453 |
| 2018年08月31日 21:56:05 | brett.cannon | set | messages: + msg324445 |
| 2018年08月19日 10:30:44 | serhiy.storchaka | set | messages:
+ msg323750 versions: + Python 3.8, - Python 3.7 |
| 2018年07月10日 22:05:36 | vstinner | set | nosy:
- vstinner |
| 2018年07月08日 20:14:07 | brett.cannon | set | messages: + msg321289 |
| 2018年07月08日 07:42:50 | serhiy.storchaka | set | messages: + msg321267 |
| 2018年05月14日 16:37:41 | pmpp | set | nosy:
+ pmpp |
| 2018年05月14日 16:37:00 | serhiy.storchaka | set | messages: + msg316536 |
| 2018年05月14日 16:20:09 | serhiy.storchaka | set | pull_requests: + pull_request6497 |
| 2017年12月03日 20:57:06 | Decorater | set | messages: + msg307524 |
| 2017年11月21日 01:45:15 | brett.cannon | set | messages: + msg306610 |
| 2017年11月20日 15:37:35 | Decorater | set | nosy:
+ Decorater messages: + msg306556 |
| 2017年10月17日 20:44:56 | barry | set | messages: + msg304531 |
| 2017年10月17日 20:43:40 | barry | set | pull_requests: + pull_request3998 |
| 2017年10月16日 21:42:31 | barry | set | messages: + msg304484 |
| 2017年10月16日 21:38:31 | barry | set | nosy:
+ barry |
| 2017年08月03日 13:04:19 | jarondl | set | nosy:
+ jarondl messages: + msg299705 |
| 2016年12月13日 17:51:29 | brett.cannon | set | messages: + msg283130 |
| 2016年12月11日 19:06:14 | brett.cannon | set | messages: + msg282938 |
| 2016年12月10日 21:16:17 | serhiy.storchaka | set | messages: + msg282876 |
| 2016年12月10日 20:14:24 | gregory.p.smith | set | messages: + msg282871 |
| 2016年12月09日 13:16:50 | vstinner | set | messages: + msg282777 |
| 2016年12月09日 12:34:56 | serhiy.storchaka | set | files:
+ zipimport-2.patch messages: + msg282776 |
| 2016年12月08日 19:46:09 | serhiy.storchaka | set | files:
+ zipimport.patch versions: + Python 3.7, - Python 3.6 messages: + msg282731 keywords: + patch type: enhancement stage: patch review |
| 2016年01月06日 14:41:28 | superluser | set | messages: + msg257609 |
| 2016年01月05日 05:48:21 | diana | set | nosy:
+ diana |
| 2016年01月02日 20:29:36 | brett.cannon | set | messages: + msg257360 |
| 2015年12月11日 08:25:08 | vstinner | set | nosy:
+ vstinner messages: + msg256207 |
| 2015年12月10日 08:40:21 | serhiy.storchaka | set | messages: + msg256171 |
| 2015年12月09日 21:12:19 | superluser | set | messages: + msg256161 |
| 2015年11月23日 20:41:02 | serhiy.storchaka | set | messages: + msg255224 |
| 2015年11月23日 20:40:42 | serhiy.storchaka | set | messages: - msg255223 |
| 2015年11月23日 20:40:34 | serhiy.storchaka | set | messages: + msg255223 |
| 2015年11月23日 20:40:09 | serhiy.storchaka | set | messages: - msg255222 |
| 2015年11月23日 20:39:50 | serhiy.storchaka | set | messages: + msg255222 |
| 2015年11月23日 20:33:14 | eric.snow | set | nosy:
+ eric.snow, superluser |
| 2015年11月23日 17:23:42 | brett.cannon | set | messages: + msg255202 |
| 2015年11月23日 17:15:22 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg255198 |
| 2015年11月23日 16:36:10 | byrnes | set | nosy:
+ byrnes |
| 2015年11月23日 16:29:06 | brett.cannon | link | issue25710 dependencies |
| 2015年11月23日 16:28:40 | brett.cannon | create | |