Martin Panter added the comment:

It looks like the default has been hard-coded to 9 ever since tarfile was added 
to Python. The gzip module is also hard-coded to 9 since it was added. If 
tarfile is changed, maybe gzip should too.

Why would you want to use zlib’s default (apparently 6)? Memory usage or speed 
perhaps? If we do change the default, maybe it is best to only do it in 3.6. I 
don’t see it as a bug fix, and there is a chance it could break someone’s code.

To be able to control the compression level, perhaps you can already do it by 
wrapping the tar stream with GzipFile (untested):

gz_writer = GzipFile(fileobj=raw_writer, mode="wb", compresslevel=...)
tar_writer = tarfile.open(fileobj=gz_writer, mode="w|")
tar_writer.addfile(...)
tar_writer.close()
gz_writer.close()

If the default is changed, it certainly makes sense to add an easy compression 
level parameter, to be able to restore the old behaviour.

----------
nosy: +martin.panter
type: behavior -> enhancement
versions:  -Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26253>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to