Skip to content

Commit

Permalink
Fix for super() usage on "old style class" ZipFile (#546)
Browse files Browse the repository at this point in the history
I was experienceing an error of "TypeError: must be type, not classobj"
on the line using `super()._extract_member()` below.
This error appears to be due to the `zipfile.ZipFile` class never inheriting from
`object` which is a requirement since py2.2 (2001).

Since the use of `super()` in `PermPreservingZipFile()` depends on
`object` being somewhere in the inheritance tree, I am including it in
the class definition of `PermPreservingZipFile()`. My testing of this patch
locally has proven to solve the "TypeError" I was seeing.
  • Loading branch information
cbrinker authored and jsirois committed Sep 6, 2018
1 parent 8f9c8dd commit 9bba75d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pex/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def teardown(self):
_MKDTEMP_SINGLETON = MktempTeardownRegistry()


class PermPreservingZipFile(zipfile.ZipFile):
class PermPreservingZipFile(zipfile.ZipFile, object):
"""A ZipFile that works around https://bugs.python.org/issue15795"""

def _extract_member(self, member, targetpath, pwd):
Expand Down

0 comments on commit 9bba75d

Please sign in to comment.