File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -439,10 +439,20 @@ def filter_fcn(info):
439439 # Strip high bits & group/other write bits
440440 info .mode &= 0o755
441441 return True
442-
442+ if sys .version_info [:2 ] < (3 ,12 ):
443+ tar_args = {}
444+ else :
445+ # Add a tar filter to suppress deprecation warning in Python 3.12+
446+ #
447+ # Note that starting in Python 3.14 the default is 'data',
448+ # however, this method is already filtering for many of the
449+ # things that 'data' would catch (and raise an exception
450+ # for). For backwards compatibility, we will use the more
451+ # permissive "tar" filter.
452+ tar_args = {'filter' : tarfile .tar_filter }
443453 with tarfile .open (fileobj = io .BytesIO (self .retrieve_url (url ))) as TAR :
444454 dest = os .path .realpath (self ._fname )
445- TAR .extractall (dest , filter (filter_fcn , TAR .getmembers ()))
455+ TAR .extractall (dest , filter (filter_fcn , TAR .getmembers ()), ** tar_args )
446456
447457 def get_gzipped_binary_file (self , url ):
448458 if self ._fname is None :
You can’t perform that action at this time.
0 commit comments