Skip to content

Commit 2592f32

Browse files
committed
CVE-2007-4559 Remove invalid tests, get others working with Python2
1 parent 53576c4 commit 2592f32

File tree

2 files changed

+136
-107
lines changed

2 files changed

+136
-107
lines changed

Lib/tarfile.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,22 @@ def __iter__(self):
916916
if not line:
917917
break
918918
yield line
919+
920+
def __enter__(self):
921+
#INFO: This was used in Python3.6, but we aren't based off io.BufferedReader in Python2
922+
# self._check()
923+
return self
924+
925+
def __exit__(self, type, value, traceback):
926+
if type is None:
927+
self.close()
928+
else:
929+
# An exception occurred. We must not call close() because
930+
# it would try to write end-of-archive blocks and padding.
931+
#INFO: This was used in Python3.6, but we aren't based off io.BufferedReader in Python2
932+
# if not self._extfileobj:
933+
# self.fileobj.close()
934+
self.close()
919935
#class ExFileObject
920936

921937
#------------------

0 commit comments

Comments
 (0)