[issue47200] Add ZipInfo.mode property

Sam Ezeh report at bugs.python.org
Sat Apr 2 08:21:15 EDT 2022


New submission from Sam Ezeh <sam.z.ezeh at gmail.com>:

Initially, I was looking at bpo-18262 and saw the following Stack Overflow thread that was linked.

https://stackoverflow.com/questions/434641/how-do-i-set-permissions-attributes-on-a-file-in-a-zip-file-using-pythons-zip/6297838

I've attached a patch that gives ZipInfo objects a `ZipInfo.mode` property getter and setter to get and set the file mode.

I considered adding ZipFile.chmod but I didn't know how it would work given that archives can contain duplicate files.

As an aside, I wondered if there's a way to update file attributes inside zip archives without deleting and rewriting them and if not, whether it would be worthwhile to add one.

----------
components: Library (Lib)
files: sam_ezeh.patch
keywords: patch
messages: 416550
nosy: sam_ezeh
priority: normal
severity: normal
status: open
title: Add ZipInfo.mode property
type: enhancement
versions: Python 3.11
Added file: https://bugs.python.org/file50715/sam_ezeh.patch

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47200>
_______________________________________


More information about the Python-bugs-list mailing list