[issue19201] Add 'x' mode to lzma.open()

2013-10-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b7948aaca1dd by Nadeem Vawda in branch 'default':
Issue #19201: Add support for the 'x' mode to the lzma module.
http://hg.python.org/cpython/rev/b7948aaca1dd

--
nosy: +python-dev

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



[issue19201] Add 'x' mode to lzma.open()

2013-10-18 Thread Nadeem Vawda

Nadeem Vawda added the comment:

Fix committed. Thanks for the patches!

As Jesús and Terry have said, this won't be backported to 3.3/2.7, since
it is a new feature.


[oylenshpeegul]
| It's weird how different these three patches are! We're
| essentially doing the same thing: please allow the x option to pass
| through to builtins.open. Why don't these three modules look more alike?

Mostly because they were written at different times, by different people,
with different things to be backward-compatible with. Ideally they would
share the bulk of their code, but it's tricky to do that without changing
behavior in some corner cases.

--

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



[issue19201] Add 'x' mode to lzma.open()

2013-10-18 Thread Nadeem Vawda

Nadeem Vawda added the comment:

[terry.reedy]
| Arfrever's point about the order of characters makes me wonder why mode
| strings (as opposed to characters in the strings) are being checked.
| The following tests that exactly one of w, a, x appear in mode.
|  if len({'w', 'a', 'x'}  set(mode)) == 1:
| If mode is eventually passed to open(), the latter would do what ever
| it does with junk chars in mode (such as 'q').

There are two separate questions here - how rigid we are about modes
containing only valid characters, and how we handle invalid characters.

I don't think there's any point in passing through unrecognized chars
to builtins.open(), since it results in a ValueError either way.

On the first point, the code only accepts modes like 'r' and 'rb' (but
not 'br') for the sake of simplicity. There doesn't seem to be much
practical value in accepting arbitrarily-ordered modes, but if someone
has a compelling use-case (or a patch that's no more complex than the
status quo), please bring it up in a separate issue.

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

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



[issue19201] Add 'x' mode to lzma.open()

2013-10-15 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Stopped the leaking after running the test by adding self.addCleanup.

--
Added file: http://bugs.python.org/file32130/add_x_mode_to_lzma_v3.patch

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



[issue19201] Add 'x' mode to lzma.open()

2013-10-13 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Added doc. Revamped the test. The patch did not cater to the order of modes 
(wb is equal to bw?). I think that deserves a separate ticket.

--
Added file: http://bugs.python.org/file32077/add_x_mode_to_lzma_v2.patch

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



[issue19201] Add 'x' mode to lzma.open()

2013-10-12 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
components: +Library (Lib)
title: Add 'x' mode to lzma.open - Add 'x' mode to lzma.open()

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



[issue19201] Add 'x' mode to lzma.open

2013-10-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The bug versus feature issue does not depend on whether the patch could cause a 
regression. (I think feature patches might actually be less likely than bug 
fixes to cause regressions, but it does not matter.) Nor is oversight, not 
adding a feature when it could have been added, a bug. The point is that adding 
a new feature in a bug-fix release makes it a feature release, and this is a 
new feature. Code that uses the new feature will not run on previous releases 
of the same version.

The doc for lzma.open says The mode argument can be any of r, rb, w, 
wb, a or ab for binary mode, or rt, wt, or at for text mode. The 
default is rb. (I assume that) the code does just what the doc says. (If it 
did not, *that* would be a bug).

Arfrever's point about the order of characters makes me wonder why mode strings 
(as opposed to characters in the strings) are being checked. The following 
tests that exactly one of w, a, x appear in mode.
  if len({'w', 'a', 'x'}  set(mode)) == 1:
If mode is eventually passed to open(), the latter would do what ever it does 
with junk chars in mode (such as 'q').

--
nosy: +terry.reedy
title: lzma and 'x' mode open - Add 'x' mode to lzma.open
versions:  -Python 3.3

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