[issue21872] LZMA library sometimes fails to decompress a file

2014-06-28 Thread Esa Peuha

Esa Peuha added the comment:

This code

import _lzma
with open('22h_ticks_bad.bi5', 'rb') as f:
infile = f.read()
for i in range(8191, 8195):
decompressor = _lzma.LZMADecompressor()
first_out = decompressor.decompress(infile[:i])
first_len = len(first_out)
last_out = decompressor.decompress(infile[i:])
last_len = len(last_out)
print(i, first_len, first_len + last_len, decompressor.eof)

prints this

8191 36243 45480 True
8192 36251 45473 False
8193 36253 45475 False
8194 36260 45480 True

It seems to me that this is a subtle bug in liblzma; if the input stream to the 
incremental decompressor is broken at the wrong place, the internal state of 
the decompressor is corrupted. For this particular file, it happens when the 
break occurs after reading 8192 or 8193 bytes, and lzma.py happens to use a 
buffer of 8192 bytes. There is nothing wrong with the compressed file, since 
lzma.py decompresses it correctly if the buffer size is set to almost any other 
value.

--
nosy: +Esa.Peuha

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



[issue21876] os.rename(src, dst) does nothing when src and dst files are hard-linked

2014-06-27 Thread Esa Peuha

Esa Peuha added the comment:

This looks like a documentation bug. Functions in module os are usually just 
thin wrappers around the underlying OS functions, and POSIX states that doing 
nothing is the correct thing to do here. (It is arguably a bug in early Unix 
implementations that got mistakenly codified as part of POSIX, and it is 
certainly inconsistent with the POSIX requirement that the mv command *must* 
remove the source file in this case, but there is nothing Python can do about 
that.)

--
nosy: +Esa.Peuha

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



[issue19325] _osx_support imports many modules

2013-10-22 Thread Esa Peuha

Esa Peuha added the comment:

Actually Lib/_osx_support.py directly imports only five modules: os, re and sys 
at top level, and contextlib and tempfile in _read_output(). These last two 
aren't really needed at all, and there's no point even trying to avoid 
importing os and sys, so the only real problem is re which imports lots of 
other modules. It might be possible to avoid using re (the regular expressions 
don't look very complicated) but I noticed that some functions are only ever 
called from distutils, so maybe they should be moved from _osx_support to 
distutils._osx_support before doing anything else. I'm willing to do that if 
it's considered a good idea.

--
nosy: +Esa.Peuha

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



[issue19335] codeop misclassifies incomplete code with 'nonlocal'

2013-10-22 Thread Esa Peuha

Esa Peuha added the comment:

> Someone needs to compare _maybe_compile to the equivalent C code used by the 
> real interpreter.

Well, _maybe_compile() just calls the built-in function compile() internally, 
so I'm not sure what sort of comparison you want...

--
nosy: +Esa.Peuha
title: codeop misclassifies incomple code with 'nonlocal' -> codeop 
misclassifies incomplete code with 'nonlocal'

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



[issue18650] intermittent test_pydoc failure on 3.4.0a1

2013-10-21 Thread Esa Peuha

Esa Peuha added the comment:

The problem seems to be 
/Users/pyi/Library/Python/3.4/lib/python/site-packages/setuptools-0.9.8-py3.4.egg
 according to the error page. What is that file? The fact that the second run 
of the test succeeds implies that it could be a temporary file which is no 
longer present when the test is run again.

--
nosy: +Esa.Peuha

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



[issue19275] test_site is failing on AMD64 Snow Leopard

2013-10-17 Thread Esa Peuha

Esa Peuha added the comment:

Just by looking at the code, there still seems to be a problem: test_site.py 
was changed in 0b6052f2a8ee to test that the collections module isn't imported, 
but due to a bug it (re)tests the re module instead (re_mods needs to be 
changed to collection_mods).

--

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



[issue19275] test_site is failing on AMD64 Snow Leopard

2013-10-17 Thread Esa Peuha

Esa Peuha added the comment:

Apparently related to issue 19205 and issue 19209. Looks like _osx_support 
imports re which imports copyreg.

--
nosy: +Esa.Peuha

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



[issue19246] GC does not really free up memory in console

2013-10-14 Thread Esa Peuha

Esa Peuha added the comment:

> So best guess is that Microsoft's allocators have gotten fatally fragmented, 
> but I don't know how to confirm/refute that.

Let's test this in pure C. Compile and run the attached uglyhack.c on win32; if 
it reports something significantly less than 100%, it's probably safe to 
conclude that this has nothing to do with Python.

--
nosy: +Esa.Peuha
Added file: http://bugs.python.org/file32110/uglyhack.c

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



[issue12853] global name 'r' is not defined in upload.py

2013-10-12 Thread Esa Peuha

Esa Peuha added the comment:

> so I don't know where the "global name 'r' is not defined" message came from.

It came from Python 2.7. There are two separate bugs here, one in 3.x and the 
other in 2.7: the 3.x bug has to do with bytes/string separation, while the 2.7 
bug is that result was changed to r in baf1a482b57d.

--
nosy: +Esa.Peuha

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



[issue19202] Additions to docs

2013-10-09 Thread Esa Peuha

Esa Peuha added the comment:

How would you give a single definition of reduce() that helps people to 
understand both 2-arg and 3-arg variants? The way it is implemented in C is 
impossible to duplicate in pure Python; the best you could do is a hack that 
works unless someone *tries* to break it, but that would just be confusing.

--

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



[issue19202] Additions to docs

2013-10-09 Thread Esa Peuha

New submission from Esa Peuha:

Here are some additions to documentation of a few functions:

all, any: alternative definitions using functools.reduce
enumerate: alternative definition using zip and itertools.count
sum: equivalent definition using functools.reduce and operator.add
functools.reduce: equivalent definitions, use operator.add in example
itertools.accumulate: point to functools.reduce
itertools.filterfalse: point to filter

--
assignee: docs@python
components: Documentation
files: doc.diff
keywords: patch
messages: 199281
nosy: Esa.Peuha, docs@python
priority: normal
severity: normal
status: open
title: Additions to docs
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file32013/doc.diff

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



[issue19165] Change formatter warning to DeprecationWarning in 3.5

2013-10-09 Thread Esa Peuha

Esa Peuha added the comment:

The wanted patch seems to be very simple: change PendingDeprecationWarning to 
DeprecationWarning on line 24 of Lib/formatter.py but only for Python 3.5 (i.e. 
no need to do anything until 3.4 is released).

On a related note, should formatter be added to PEP 4?

--
nosy: +Esa.Peuha

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



[issue19182] Socket leak in logging.handlers

2013-10-06 Thread Esa Peuha

New submission from Esa Peuha:

Running test_logging produces the following:

/home/peuha/python/cpython/Lib/logging/handlers.py:550: ResourceWarning: 
unclosed 
  self.retryTime = now + self.retryPeriod
/home/peuha/python/cpython/Lib/logging/handlers.py:550: ResourceWarning: 
unclosed 
  self.retryTime = now + self.retryPeriod

This turns out to be a bug in SocketHandler.makeSocket; the attachment should 
fix it.

--
components: Library (Lib)
files: logging.handlers.diff
keywords: patch
messages: 199074
nosy: Esa.Peuha
priority: normal
severity: normal
status: open
title: Socket leak in logging.handlers
type: behavior
Added file: http://bugs.python.org/file31973/logging.handlers.diff

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



[issue19148] Minor issues with Enum docs

2013-10-02 Thread Esa Peuha

New submission from Esa Peuha:

I noticed a couple of issues with the Enum documentation. First, there are some 
markup bugs which should be fixed by the attached file. Second, I think "If the 
only change desired is no aliases allowed" is very bad English and should be 
reworded; I would go with "If you only want to disallow aliases" but maybe 
other people have better ideas.

--
assignee: docs@python
components: Documentation
files: enum.diff
keywords: patch
messages: 198869
nosy: Esa.Peuha, docs@python
priority: normal
severity: normal
status: open
title: Minor issues with Enum docs
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31947/enum.diff

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