Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue14736] Add {encode, decode}_filter_properties() functions to lzma module

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

May 5, 2012, 6:08 PM

Post #1 of 8 (130 views)
Permalink
[issue14736] Add {encode, decode}_filter_properties() functions to lzma module

New submission from Nadeem Vawda <nadeem.vawda [at] gmail>:

Patch attached. Reviews welcome.

----------
components: Extension Modules
files: lzma-properties.diff
keywords: patch
messages: 160051
nosy: nadeem.vawda
priority: normal
severity: normal
stage: patch review
status: open
title: Add {encode,decode}_filter_properties() functions to lzma module
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file25478/lzma-properties.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14736>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 6, 2012, 1:27 AM

Post #2 of 8 (112 views)
Permalink
[issue14736] Add {encode, decode}_filter_properties() functions to lzma module [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

The functionality looks a bit cryptic to me. What is the use case?

I wonder if Py_LONG_LONG is always defined (although it certainly is on major platforms).
Other than that, the patch looks technically correct, though I'm not an lzma expert.

----------
nosy: +pitrou

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14736>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 6, 2012, 3:34 AM

Post #3 of 8 (110 views)
Permalink
[issue14736] Add {encode, decode}_filter_properties() functions to lzma module [In reply to]

Nadeem Vawda <nadeem.vawda [at] gmail> added the comment:

> The functionality looks a bit cryptic to me. What is the use case?

Serializing filter specifiers for custom file formats. The particular
case that prompted adding the code is zipfile (issue 14366).

I've added a note to the docs and docstrings explaining this.


> I wonder if Py_LONG_LONG is always defined (although it certainly is on major platforms).

I expect it will always be defined on platforms that support liblzma -
the API uses uint64_t in quite a few places, via the lzma_vli typedef.

In any case, _lzmamodule.c checks for PY_LONG_LONG explicitly at
compile-time and gives a useful error message if it is undefined.

----------
Added file: http://bugs.python.org/file25480/lzma-properties.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14736>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 6, 2012, 3:38 AM

Post #4 of 8 (108 views)
Permalink
[issue14736] Add {encode, decode}_filter_properties() functions to lzma module [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

The updated patch looks ok to me.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14736>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 6, 2012, 2:10 PM

Post #5 of 8 (108 views)
Permalink
[issue14736] Add {encode, decode}_filter_properties() functions to lzma module [In reply to]

Nadeem Vawda <nadeem.vawda [at] gmail> added the comment:

Committed as changeset 9118ef2b651a.

----------
resolution: -> fixed
stage: patch review -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14736>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 6, 2012, 4:05 PM

Post #6 of 8 (114 views)
Permalink
[issue14736] Add {encode, decode}_filter_properties() functions to lzma module [In reply to]

Serhiy Storchaka <storchaka [at] gmail> added the comment:

Thank you, Nadeem Vawda. I also wrote a patch for this, but because of the lack of experience it was too cumbersome.

But there are no tests for these functions. I tried to use these functions and got the random values.

>>> lzma.decode_filter_properties(lzma.FILTER_LZMA1, lzma.encode_filter_properties({'id': lzma.FILTER_LZMA1, 'preset': 6}))
{'mode': 3075124424, 'dict_size': 8388608, 'id': 4611686018427387905, 'lp': 0, 'nice_len': 739426833, 'depth': 0, 'lc': 3, 'mf': 0, 'pb': 2}
>>> lzma.decode_filter_properties(lzma.FILTER_LZMA1, lzma.encode_filter_properties({'id': lzma.FILTER_LZMA1, 'preset': 6}))
{'mode': 0, 'dict_size': 8388608, 'id': 4611686018427387905, 'lp': 0, 'nice_len': 2053908595, 'depth': 0, 'lc': 3, 'mf': 0, 'pb': 2}
>>> lzma.decode_filter_properties(lzma.FILTER_LZMA1, lzma.encode_filter_properties({'id': lzma.FILTER_LZMA1, 'preset': 6}))
{'mode': 0, 'dict_size': 8388608, 'id': 4611686018427387905, 'lp': 0, 'nice_len': 2053908595, 'depth': 0, 'lc': 3, 'mf': 0, 'pb': 2}

It seems, 'mode' and 'nice_len' was not initialized.

Tests for zipfile module with the use of these functions are broken, and I don't know, this happens because of errors in these functions or in zipfile module.

----------
nosy: +storchaka

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14736>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 6, 2012, 10:11 PM

Post #7 of 8 (112 views)
Permalink
[issue14736] Add {encode, decode}_filter_properties() functions to lzma module [In reply to]

Nadeem Vawda <nadeem.vawda [at] gmail> added the comment:

Changeset 9118ef2b651a was broken, but the bug should have been fixed by
changeset 10ccbb90a8e9. Which revision have you been using?

> But there are no tests for these functions.

There *are* tests for these functions, and they were failing on some of
the buildbots for the original changeset. They are currently passing.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14736>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 7, 2012, 1:47 AM

Post #8 of 8 (110 views)
Permalink
[issue14736] Add {encode, decode}_filter_properties() functions to lzma module [In reply to]

Serhiy Storchaka <storchaka [at] gmail> added the comment:

> Changeset 9118ef2b651a was broken, but the bug should have been fixed by
> changeset 10ccbb90a8e9. Which revision have you been using?

I used the revision 76809:ab57e29157bb. Yes, now the bug fixed. Thank
you once again.

----------
title: Add {encode,decode}_filter_properties() functions to lzma module -> Add {encode, decode}_filter_properties() functions to lzma module

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14736>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.