bpo-4833: Add ZipFile.mkdir by dignissimus · Pull Request #32160 · python/cpython
| else: | ||
| zinfo._compresslevel = self.compresslevel | ||
|
|
||
| if zinfo.is_dir(): |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that write can no longer be used to create a directory? I suspect that will break existing code.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was marked as resolved, but I do not see an answer to my question.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think write still accepts directory zinfo, now it’s handled on line 1775 by calling mkdir instead of directly inline here.
There should be a test for write + directory; if not, then this PR needs to add one!
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right -- 1175 does handle that. Thanks!
A fairly quick scan of the tests doesn't reveal one using .write(some_directory/). @dignissimus please confirm such a test already exists, or add one.