[issue26253] tarfile in stream mode always set zlib compression level to 9

2017-08-01 Thread Yaron de Leeuw

Yaron de Leeuw added the comment:

I have submitted a PR on GitHub https://github.com/python/cpython/pull/2962

--
nosy: +jarondl
versions: +Python 3.7 -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26253] tarfile in stream mode always set zlib compression level to 9

2017-07-31 Thread Yaron de Leeuw

Changes by Yaron de Leeuw :


--
pull_requests: +3009

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26253] tarfile in stream mode always set zlib compression level to 9

2017-06-28 Thread wim glenn

wim glenn added the comment:

This issue also got me.  compresslevel kwarg works fine for tarfile.open(..., 
mode='w:gz') but raises exception for tarfile.open(..., mode='w|gz')

I want to use stream compression, and compresslevel=1 is more than enough for 
my use case, the default of 9 is way too slow.

--
nosy: +wim.glenn

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26253] tarfile in stream mode always set zlib compression level to 9

2017-04-30 Thread Xiang Zhang

Xiang Zhang added the comment:

*compresslevel* takes effect for modes 'w:gz', 'r:gz', 'w:bz2', 'r:bz2', 
'x:gz', 'x:bz2'. For stream modes, 'r|gz', 'w|gz', 'r|bz2', 'w|bz2', the 
*compresslevel* doesn't make sense. It seems not hard to make it possible but 
I'm not sure it's worth it or there is any reason it's hard-coded.

--
nosy: +xiang.zhang

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26253] tarfile in stream mode always set zlib compression level to 9

2016-02-11 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +lars.gustaebel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26253] tarfile in stream mode always set zlib compression level to 9

2016-02-09 Thread Martin Panter

Martin Panter added the comment:

Actually it’s not really obvious from the signatures, but in the middle of the 
tarfile.open() documentation it says “. . . tarfile.open() accepts the keyword 
argument _compresslevel_”, so it should already be possible.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26253] tarfile in stream mode always set zlib compression level to 9

2016-01-31 Thread Patrik Dufresne

New submission from Patrik Dufresne:

When using tarfile.open(mode='w|gz'), the compression level is hard-coded to 9. 
Seed _Stream._init_write_gz():
self.zlib.compressobj(9,

1. In regards to zlib, I would start by replacing the value of 9 by 
zlib.Z_DEFAULT_COMPRESSION. This is the default value and zipfile is using it. 
Why using something different.

2. Then, I would also love to control the compression level when calling 
tarfile.open()

--
components: Library (Lib)
messages: 259304
nosy: Patrik Dufresne
priority: normal
severity: normal
status: open
title: tarfile in stream mode always set zlib compression level to 9
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26253] tarfile in stream mode always set zlib compression level to 9

2016-01-31 Thread Martin Panter

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com