[issue12263] punycode codec ignores the error handler argument

2011-06-21 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

What's the point of disallowing the replace error handler? That's a slightly 
incompatible change, isn't it?

--

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



[issue12365] URLopener should support context manager protocol

2011-06-21 Thread Senthil Kumaran

Senthil Kumaran sent...@uthcode.com added the comment:

I forgot completely, but in Python3, Issue5418 had already added
support to addinfourl. It is now possible to write code like

import urllib.request

with urllib.request.urlopen('http://www.python.org') as req:
res = req.read()

But yeah, unlike normal file objects, it not a strict requirement for
closing those objects as they will be closed when socket connection is
closed.

This is available only 3.x series and I think, a documentation update
should be fine and this report can be closed.

--

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



[issue12263] punycode codec ignores the error handler argument

2011-06-21 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Oh, I forgot to give a little bit more details.

b'abc\xff-'.decode('punycode', 'ignore') and b'abc\xff-'.decode('punycode', 
'replace') raise a UnicodeDecodeError: the error handler is just useless 
(ignored) here.

With my patch, b'abc\xff-'.decode('punycode', 'ignore') gives 'abc'. (If I 
change the code to accept replace) b'abc\xff-'.decode('punycode', 'replace') 
gives also 'abc', but 'replace' doesn't work correctly in the part after - 
contain illegal byte sequences.

For example, b'a\xff-\xffb\xffga\xff'.decode(punycode, replace) gives 'a�', 
whereas I would expect 'a�é' or 'aé�'. b'a-bga\xff'.decode(punycode, 
replace) gives 'aé' as b'a-bga'.decode(punycode, replace), whereas I 
would expect 'aé�' or something like that.

 What's the point of disallowing the replace error handler?

It's just that I'm unable to patch punycode decoder to support the replace 
handler. Do you want to implement it?

 That's a slightly incompatible change, isn't it?

I don't think so because I consider that the punycode decoder never supported 
error handlers (other than strict) in Python 3.

What do you think?

--

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



[issue12352] multiprocessing.Value() hangs

2011-06-21 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

 The obvious solution is to use a recursive lock instead.

Note that it's not really a solution, just a workaround to avoid
deadlocks, become this might lead to a corruption if free is called
while the heap is in an inconsistent state. I have to think some more
about a final solution, but I'd like to check first that this is
really what's happening here.

--

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



[issue12352] multiprocessing.Value() hangs

2011-06-21 Thread greg.ath

greg.ath gathan...@gmail.com added the comment:

Hi,

I also wonder about the performance cost of a recursive lock.

I am still unable to reproduce the bug in a simple script. Looking
closely to the gdb stack, there is that frame:
Frame 0x13be190, for file /usr/lib/python2.6/multiprocessing/heap.py, line 173
I understand that python reuses only the beginning of a memory block,
so it frees the remaining of the block.
I use both Value(c_int) and Value(c_double), which have different
sizes. That may explain that behaviour.

in heap.py, in the malloc function:
167 self._lock.acquire()
168 try:
169 size = self._roundup(max(size,1), self._alignment)
170 (arena, start, stop) = self._malloc(size)
171 new_stop = start + size
172 if new_stop  stop:
173 self._free((arena, new_stop, stop))

Thanks for your help

2011/6/21 Charles-François Natali rep...@bugs.python.org:

 Charles-François Natali neolo...@free.fr added the comment:

 The obvious solution is to use a recursive lock instead.

 Note that it's not really a solution, just a workaround to avoid
 deadlocks, become this might lead to a corruption if free is called
 while the heap is in an inconsistent state. I have to think some more
 about a final solution, but I'd like to check first that this is
 really what's happening here.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue12352
 ___


--

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



[issue12352] multiprocessing.Value() hangs

2011-06-21 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

 Looking closely to the gdb stack, there is that frame:

Yeah, but it calls _free, which runs unlocked. That's not the problem.

 I am still unable to reproduce the bug in a simple script.

Try with this one:


import multiprocessing.heap


tab = []

for i in range(10):
print(i)
b = multiprocessing.heap.BufferWrapper(10)
# create a circular reference (we want GC and not refcount collection when
# the block goes out of scope)
b.tab = tab
tab.append(b)
# drop buffers refcount to 0 to make them eligible to GC
if i % 100 == 0:
del tab
tab = []


It deadlocks pretty quickly (well, on my box).
And, as expected, disabling/enabling the GC inside malloc solves the problem.
I have to think a little bit more for a clean solution.

--
nosy: +pitrou

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



[issue12379] build outside source fail in head

2011-06-21 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

In which file there's an error? Could you elaborate a bit?

--
nosy: +petri.lehtinen

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



[issue12296] Minor clarification in devguide

2011-06-21 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

New semantics may also be something else than new classes or functions. New 
optional function arguments exposing new functionality, for example.

--
nosy: +petri.lehtinen

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



[issue12352] multiprocessing.Value() hangs

2011-06-21 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 I also wonder about the performance cost of a recursive lock.

An alternative is to disable the garbage collector in malloc():

def malloc(self, size):
...
enabled = gc.isenabled()
if enabled:
# disable the garbage collector to avoid a deadlock if block
# is freed (if self.free() is called)
gc.disable()
try:
with self._lock:
size = self._roundup(max(size,1), self._alignment)
...
return block
finally:
if enabled:
gc.enable()

gc.disable() and gc.enable() just set an internal flag and so should be fast.

--
nosy: +haypo

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



[issue11909] Doctest sees directives in strings when it should only see them in comments

2011-06-21 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

The patch looks good to me. It passes the old doctests tests and adds a new 
test case for what it's fixing.

--
nosy: +petri.lehtinen, tim_one

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



[issue11869] Include information about the bug tracker Rietveld code review tool

2011-06-21 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
nosy: +petri.lehtinen

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



[issue11708] argparse: suggestion for formatting optional positional args

2011-06-21 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
nosy: +petri.lehtinen

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



[issue11708] argparse: suggestion for formatting optional positional args

2011-06-21 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
nosy: +bethard

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



[issue12382] [msilib] Ambiguous exception message when trying to open a non existing MSI database

2011-06-21 Thread Robin Jarry

New submission from Robin Jarry diabete...@gmail.com:

When trying to open a non existing MSI database, an obscure unknown error 6e 
is raised.

Could it be possible to get a more explicit message such as File not found or 
whatever ? 

Thanks :)

Here is a example:



D:\ll
total 0
drwxr-xr-x4 tcinteg  Administ0 Nov 30  2010 RECYCLER
drwxr-xr-x0 tcinteg  Administ0 Jul  6  2009 System Volume 
Information
drwxr-xr-x4 tcinteg  Administ0 Apr 29 16:03 TC
drwxr-xr-x3 tcinteg  Administ0 Apr 29 15:43 stgloc

D:\python
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import msilib
 db = msilib.OpenDatabase(I_Do_Not_Exist.msi, msilib.MSIDBOPEN_READONLY)
Traceback (most recent call last):
  File stdin, line 1, in module
_msi.MSIError: unknown error 6e


--
components: Library (Lib)
messages: 138781
nosy: Robin.Jarry, loewis
priority: normal
severity: normal
status: open
title: [msilib] Ambiguous exception message when trying to open a non existing 
MSI database
type: behavior
versions: Python 2.7

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



[issue12382] [msilib] Obscure exception message when trying to open a non-existent MSI database

2011-06-21 Thread Robin Jarry

Robin Jarry diabete...@gmail.com added the comment:

changed the headline of the defect for something more meaningful :)

--
title: [msilib] Ambiguous exception message when trying to open a non existing 
MSI database - [msilib] Obscure exception message when trying to open a 
non-existent MSI database

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



[issue12382] [msilib] Obscure exception message when trying to open a non-existent MSI database

2011-06-21 Thread Tim Golden

Changes by Tim Golden m...@timgolden.me.uk:


--
nosy: +markmcmahon, tim.golden

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



[issue11695] Improve argparse usage/help customization

2011-06-21 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
nosy: +petri.lehtinen

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



[issue11694] xdrlib raises ConversionError in inconsistent way

2011-06-21 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

This seems like a bug worth fixing. The ConversionError exception has been 
documented, an there's an example in the docs that suggest that at least all 
packing fails with a ConversionError.

--
nosy: +petri.lehtinen

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



[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-21 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

What's the use case?  I'm inclined to reject this as not needed.

--
nosy: +r.david.murray
type: behavior - feature request
versions: +Python 3.3 -Python 2.7, Python 3.1

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



[issue12381] bytearray methods count, find, index don't support None as in slice notation

2011-06-21 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

As Raymond said in another issue, someone should fix this once and for all by 
factoring this check out into a reusable method and making sure it is used 
everywhere.

--
keywords: +easy
nosy: +r.david.murray
versions: +Python 3.2, Python 3.3 -Python 3.1

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



[issue12381] bytearray methods count, find, index don't support None as in slice notation

2011-06-21 Thread Xuanji Li

Changes by Xuanji Li xua...@gmail.com:


--
nosy: +xuanji

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



[issue11869] Include information about the bug tracker Rietveld code review tool

2011-06-21 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Heh.  You are assuming we know how it should be used :)  It's pretty new yet, 
so I don't think we've figured that out.  But at at least how it works should 
be mentioned in the devguide.

--
nosy: +r.david.murray

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



[issue12383] subprocess.Popen(..., env={}) fails to pass empty env.

2011-06-21 Thread Thomas Wouters

New submission from Thomas Wouters tho...@python.org:

The addition of the _posixsubprocess module in 3.2 introduced a change of 
behaviour when passing an empty dict (or other false value besides None) as env:

python3.1 -c 'import subprocess; print(subprocess.Popen([env], env={}, 
stdout=subprocess.PIPE).communicate())'
(b'', None)

python3.2 -c 'import subprocess; print(subprocess.Popen([env], env={}, 
stdout=subprocess.PIPE).communicate())'
(b'LC_MONETARY=C\nSHELL=/bin/bash\nTERM=scr', None)

The test for 'env' being the default (None) is not explicit enough.

--
assignee: gregory.p.smith
components: Library (Lib)
files: subprocess.diff.txt
keywords: needs review, patch
messages: 138787
nosy: gregory.p.smith, twouters
priority: high
severity: normal
stage: patch review
status: open
title: subprocess.Popen(..., env={}) fails to pass empty env.
type: behavior
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file22419/subprocess.diff.txt

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



[issue12383] subprocess.Popen(..., env={}) fails to pass empty env.

2011-06-21 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset b5963fceddad by Victor Stinner in branch '3.2':
Close #12383: Fix subprocess module with env={}: don't copy the environment
http://hg.python.org/cpython/rev/b5963fceddad

New changeset 10ecf8576eb2 by Victor Stinner in branch 'default':
(merge 3.2) Close #12383: Fix subprocess module with env={}: don't copy the
http://hg.python.org/cpython/rev/10ecf8576eb2

--
nosy: +python-dev
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue12383] subprocess.Popen(..., env={}) fails to pass empty env.

2011-06-21 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 The addition of the _posixsubprocess module in 3.2 introduced
 a change of behaviour when passing an empty dict
 (or other false value besides None) as env: ...

This bug was introduced by the commit (768722b2ae0a) introducing 
_posixsubprocess.

--
nosy: +haypo

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



[issue12383] subprocess.Popen(..., env={}) fails to pass empty env.

2011-06-21 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Thanks for the fix, I added an unit test.

--

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



[issue12383] subprocess.Popen(..., env={}) fails to pass empty env.

2011-06-21 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

The test appears to be failing on the buildbots:

http://www.python.org/dev/buildbot/all/builders/x86%20Ubuntu%20Shared%203.2/builds/370

--
nosy: +r.david.murray
status: closed - open

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



[issue10403] Use member consistently

2011-06-21 Thread Adam Woodbeck

Changes by Adam Woodbeck adam.woodb...@gmail.com:


--
nosy: +adam.woodbeck

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



[issue12383] subprocess.Popen(..., env={}) fails to pass empty env.

2011-06-21 Thread Gregory P. Smith

Gregory P. Smith g...@krypto.org added the comment:

That failure is likely due to the environment being empty causing the 
subprocess to be unable to run.  Notice this error message further up:

test_empty_env (test.test_subprocess.ContextManagerTests) ... 
/srv/buildbot/buildarea/3.2.bolen-ubuntu/build/python: error while loading 
shared libraries: libpython3.2dm.so.1.0: cannot open shared object file: No 
such file or directory
FAIL

Looking at the environment at the top of the buildbot run log I'm not sure what 
it would be.

--

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



[issue12381] bytearray methods count, find, index don't support None as in slice notation

2011-06-21 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
nosy: +petri.lehtinen

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



[issue12378] smtplib.SMTP_SSL leaks socket connections on SSL error

2011-06-21 Thread Catalin Iacob

Changes by Catalin Iacob iacobcata...@gmail.com:


--
nosy: +catalin.iacob

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



[issue12363] test_signal.test_without_siginterrupt() sporadic failures on FreeBSD 6.4

2011-06-21 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

The test still fails on FreeBSD 7.2, Tiger and Debian parallel:


==
FAIL: test_siginterrupt_on (test.test_signal.SiginterruptTest)
--
Traceback (most recent call last):
  File 
/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/test/test_signal.py,
line 379, in test_siginterrupt_on
self.assertTrue(interrupted)
AssertionError: False is not true

==
FAIL: test_without_siginterrupt (test.test_signal.SiginterruptTest)
--
Traceback (most recent call last):
  File 
/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/test/test_signal.py,
line 372, in test_without_siginterrupt
self.assertTrue(interrupted)
AssertionError: False is not true


Here's a sample strace output on my Linux box when it fails:

2120  21:00:18.755448 rt_sigaction(SIGALRM, {0x810b332, [], 0}, NULL,
8) = 0 0.19
2120  21:00:18.755690 alarm(1)  = 0 0.24
2120  21:00:18.755803 read(3,  unfinished ...
[...]
2120  21:00:19.755811 ... read resumed 0xb72cad90, 1) = ?
ERESTARTSYS (To be restarted) 0.73
2120  21:00:19.755864 --- SIGALRM (Alarm clock) @ 0 (0) ---
2120  21:00:19.756094 sigreturn()   = ? (mask now []) 0.19
2120  21:00:19.756434 alarm(1)  = 0 0.23
2120  21:00:19.756547 read(3,  unfinished ...

sigaction is called without SA_RESTART, but the syscall is restarted anyway...
Apart from removing those tests, I don't see what we can do here.

--

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



[issue12383] subprocess.Popen(..., env={}) fails to pass empty env.

2011-06-21 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

On Mac OS X, the failure is different:

==
FAIL: test_empty_env (test.test_subprocess.ProcessTestCase)
--
Traceback (most recent call last):
  File 
/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/test/test_subprocess.py, 
line 400, in test_empty_env
self.assertEqual(stdout.strip(), b0)
AssertionError: b'1' != b'0'

http://www.python.org/dev/buildbot/all/builders/PPC%20Tiger%203.x/builds/2059/steps/test/logs/stdio

--

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



[issue12378] smtplib.SMTP_SSL leaks socket connections on SSL error

2011-06-21 Thread Catalin Iacob

Catalin Iacob iacobcata...@gmail.com added the comment:

Just a note after running Joe's example. smtplib is affected by this issue in 
3.x, but the example produces different results in 3.x: smtpd doesn't keep the 
connection open due to UnicodeDecodeError when the data from the ssl handshake 
cannot be decoded as utf-8:

error: uncaptured python exception, closing channel __main__.SMTPChannel 
connected 127.0.0.1:34160 at 0xb739a4cc (class 'UnicodeDecodeError':'utf8' 
codec can't decode bytes in position 13-14: invalid continuation byte 
[/mnt/data/catalin/hacking/cpython/default/Lib/asyncore.py|read|83] 
[/mnt/data/catalin/hacking/cpython/default/Lib/asyncore.py|handle_read_event|442]
 [/mnt/data/catalin/hacking/cpython/default/Lib/asynchat.py|handle_read|190] 
[/mnt/data/catalin/hacking/cpython/default/Lib/smtpd.py|collect_incoming_data|278])

--

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



[issue12383] subprocess.Popen(..., env={}) fails to pass empty env.

2011-06-21 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment:

Maybe test_empty_env() should pass LD_LIBRARY_PATH to child process.

--
nosy: +Arfrever

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



[issue12383] subprocess.Popen(..., env={}) fails to pass empty env.

2011-06-21 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset 8d46e84cd812 by Victor Stinner in branch '3.2':
Issue #12383: skip test_empty_env() if compiled is compiled in shared mode
http://hg.python.org/cpython/rev/8d46e84cd812

--

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



[issue12383] subprocess.Popen(..., env={}) fails to pass empty env.

2011-06-21 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset d1d5a7392e39 by Victor Stinner in branch 'default':
(merge 3.2) Issue #12383: skip test_empty_env() if compiled is compiled in
http://hg.python.org/cpython/rev/d1d5a7392e39

--

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



[issue12384] difflib.SequenceMatcher and Match: code and doc bugs

2011-06-21 Thread Terry J. Reedy

New submission from Terry J. Reedy tjre...@udel.edu:

The basic problem: in 2.6, a namedtuple was introduced to difflib

from collections import namedtuple as _namedtuple
Match = _namedtuple('Match', 'a b size')

and used for the return values of SeqeunceMatcher.get_longest_match and 
.get_matching_blocks. Code, docstrings, and docs were only partially updated to 
match.

Code:

def get_matching_blocks(self):
Return list of triples describing matching subsequences.
Each triple is of the form (i, j, n), and means that
...'''
if self.matching_blocks is not None:
return self.matching_blocks
...
self.matching_blocks = non_adjacent
return map(Match._make, self.matching_blocks)

The two returns are different because only the second was changed.
The obvious fix is to change the first to match. Or perhaps 
self.matching_blocks (an undocumented cache) should be the map object.

Docstring and doc for .find_longest_match():

Both start
 Find longest matching block ... returns (i, j, k) such that ... 
Doc (bug not docstring) explicitly says at the *bottom* of the entry This 
method returns a named tuple Match(a, b, size).
which is different from (i,j,n). For 2.7, the note is preceded by Changed in 
version 2.6:
The examples show the change before it is described.

I think that the current return should be accurately described at the *top* of 
the entry, not the bottom. 2.7 would then end with Changed in version 2.6: 
return Match instead of tuple.

Docstring and doc for .get_matching_blocks():

See code snippet above for beginning of text. Unlike .find_longest_match, there 
is no mention of the changed return.

In 2.7, it is a list of Match triples.
In 3.x, it is an iterable (Map) of Match triples, because of the change in 
map() return.

For the latter reason, the example in the 3.x doc must be changed to
 list(s.get_matching_blocks())

The docstring was already changed to pass doctest. The untested doc was not.

I am not sure how to properly document the use of a namedtuple in the stdlib. 
Raymond, what do you think?

--
assignee: rhettinger
components: Documentation, Library (Lib)
messages: 138799
nosy: rhettinger, terry.reedy
priority: normal
severity: normal
status: open
title: difflib.SequenceMatcher and Match: code and doc bugs
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

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



[issue12383] subprocess.Popen(..., env={}) fails to pass empty env.

2011-06-21 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 Maybe test_empty_env() should pass LD_LIBRARY_PATH to child process.

The idea of the test is to test an empty environment: if we pass one variable, 
it is no more an empty environment.

I changed the test to skip it if Python is compiled in shared mode.

--

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



[issue12263] punycode codec ignores the error handler argument

2011-06-21 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 Oh, I forgot to give a little bit more details.
 
 b'abc\xff-'.decode('punycode', 'ignore') and
 b'abc\xff-'.decode('punycode', 'replace') raise a UnicodeDecodeError:
 the error handler is just useless (ignored) here.

That's not my point:

bfoo.decode(punycode,replace)

currently succeeds, but raises an UnicodeError under the patch.

--

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



[issue12379] build outside source fail in head

2011-06-21 Thread Roumen Petrov

Roumen Petrov bugtr...@roumenpetrov.info added the comment:

cf. http://hg.python.org/cpython/rev/0d0ca6f95d9d

--

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



[issue12363] test_signal.test_without_siginterrupt() sporadic failures on FreeBSD 6.4

2011-06-21 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

Duh, don't know what I was thinking: the syscall is not restarted
(even though ERESTARTSYS is displayed by strace): the real problem is
that the 3s timeout to communicate is not enough, because spawning a
new interpreter can take a long time (Antoine created an issue some
time ago about the high number of syscalls per import). If it takes
more than 1s, the test will fail.
Also, I guess it's worst on FreeBSD because subprocess.Popen uses
close_fds=True by default, and FreeBSD has a huge default
_SC_OPEN_MAX.
I've attached a patch passing close_fds=False to spawn_python, and
running the test only once, because otherwise this would require a
timeout quite large.

--
Added file: http://bugs.python.org/file22420/test_siginterrupt.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12363
___diff -r 10ecf8576eb2 Lib/test/test_signal.py
--- a/Lib/test/test_signal.py   Tue Jun 21 17:24:21 2011 +0200
+++ b/Lib/test/test_signal.py   Tue Jun 21 23:03:18 2011 +0200
@@ -337,21 +337,19 @@
 if interrupt is not None:
 signal.siginterrupt(signal.SIGALRM, interrupt)
 
-# run the test twice
-for loop in range(2):
-# send a SIGALRM in a second (during the read)
-signal.alarm(1)
-try:
-# blocking call: read from a pipe without data
-os.read(r, 1)
-except OSError as err:
-if err.errno != errno.EINTR:
-raise
-else:
-sys.exit(2)
+# send a SIGALRM in a second (during the read)
+signal.alarm(1)
+try:
+# blocking call: read from a pipe without data
+os.read(r, 1)
+except OSError as err:
+if err.errno != errno.EINTR:
+raise
+else:
+sys.exit(2)
 sys.exit(3)
  % (interrupt,)
-with spawn_python('-c', code) as process:
+with spawn_python('-c', code, close_fds=False) as process:
 try:
 stdout, stderr = process.communicate(timeout=3.0)
 except subprocess.TimeoutExpired:
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12363] test_signal.test_without_siginterrupt() sporadic failures on FreeBSD 6.4

2011-06-21 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


Added file: http://bugs.python.org/file22421/test_siginterrupt.diff

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



[issue12363] test_signal.test_without_siginterrupt() sporadic failures on FreeBSD 6.4

2011-06-21 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


Removed file: http://bugs.python.org/file22420/test_siginterrupt.diff

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



[issue12363] test_signal.test_without_siginterrupt() sporadic failures on FreeBSD 6.4

2011-06-21 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


--
status: closed - open

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



[issue12384] difflib.SequenceMatcher and Match: code and doc bugs

2011-06-21 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

I'll take a look at this when I get a chance (est. two weeks).

--

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



[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-21 Thread py.user

py.user port...@yandex.ru added the comment:

all other methods support it and it's right

 barr = bytearray(b'abcd*')
 barr.center(len(barr) * 4, barr[-1:])
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: must be a byte string of length 1, not bytearray
 b = b'abcd*'
 b.center(len(b) * 4, b[-1:])
b'***abcd*'


--

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



[issue10403] Use member consistently

2011-06-21 Thread Adam Woodbeck

Adam Woodbeck adam.woodb...@gmail.com added the comment:

I grepped the documentation in the cpython repository and replaced all mentions 
of member(s) with attribute(s) where I felt appropriate.  I left mentions 
of members related to structs or any C documentation alone as I'm less 
confident of their terminology (I'm new around here).

I used methods and attribute in io.rst because BufferedIOBase included one 
attribute and several methods.  My terminology may be off, but I felt this was 
the correct replacement of members.

Please review the patch and critique it as necessary.

--
keywords: +patch
Added file: http://bugs.python.org/file22422/issue10403.patch

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



[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-21 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

A bytearray is for working with mutable data.  We don't support using it in all 
places that the non-mutable data types can be used.  You can code your example 
like this:

   barr.center(len(barr) * 4, bytes([barr[-1]]))

I realize that isn't particularly pretty, but that has more to do with the fact 
that indexing bytes gives you ints in Python 3 than it does with whether or not 
bytearray is accepted.

The data type of the arguments to the method have no necessary relationship 
with the datatype of the object.

You may have more success arguing that the fill character for both bytearray 
and bytes should be allowed to be an int.

I think this whole topic is better addressed in a forum such as python-ideas.  
I agree that the bytes interface is a bit wonky in places, but I think that if 
changes are going to be made a consensus needs to be developed on what changes 
to make.  I believe some conversations about this have already taken place, and 
so far I don't think there are any consensus proposals.

So, I'm going to close this issue.  But please join (or start, if necessary) 
the discussion on this wider topic in the appropriate forum.

--
resolution:  - rejected
stage:  - committed/rejected
status: open - closed

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



[issue12385] the help for bytearray.maketrans describes bytes.maketrans

2011-06-21 Thread py.user

New submission from py.user port...@yandex.ru:

help(bytearray.maketrans)

maketrans(...)
B.maketrans(frm, to) - translation table

Return a translation table (a bytes object of length 256)
suitable for use in bytes.translate where each byte in frm is
mapped to the byte at the same position in to.
The strings frm and to must be of the same length.

--
assignee: docs@python
components: Documentation
messages: 138808
nosy: docs@python, py.user
priority: normal
severity: normal
status: open
title: the help for bytearray.maketrans describes bytes.maketrans
versions: Python 3.1

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



[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-21 Thread py.user

py.user port...@yandex.ru added the comment:

 A bytearray is for working with mutable data.  We don't support using  it in 
 all places that the non-mutable data types can be used.

 bytearray(b'abcd').strip(bytearray(b'da'))
bytearray(b'bc')


.translate, .find, .partition, ...

 bytearray(b'.').join((bytearray(b'a'), bytearray(b'b')))
bytearray(b'a.b')
 bytearray(b'.').join((b'a', b'b'))
bytearray(b'a.b')


all these methods could use only bytes objects

--

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



[issue12385] the help for bytearray.maketrans describes bytes.maketrans

2011-06-21 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Hmm.  I wonder why we have two copies of this method.

Well, given that we do, the best fix for the docs would be to say for use in 
the bytes or bytearray translate method in both this docstring and the 
bytes.maketrans docstring.

--
nosy: +r.david.murray
stage:  - needs patch
type:  - behavior
versions: +Python 3.2, Python 3.3 -Python 3.1

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



[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-06-21 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

All right, let's get some other opinions from people who have actually worked 
with the bytearray and bytes code (and Terry because he cares about APIs).

--
nosy: +haypo, ncoghlan, pitrou, rhettinger, terry.reedy
status: closed - open

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



[issue12307] Inconsistent formatting of section titles in PEP 0

2011-06-21 Thread Eric Snow

Eric Snow ericsnowcurren...@gmail.com added the comment:

Yeah, the extra space results in a different formatting.  Compare Index by 
Category with Numerical Index.

--

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



[issue12308] Add link to PEP 0 for topical index in wiki

2011-06-21 Thread Eric Snow

Eric Snow ericsnowcurren...@gmail.com added the comment:

I had considered that, but thought it would be better to leave the topical 
index open for editing to a broader audience.  If it's in PEP 0 then only 
committers could make changes.

I do like the idea of using keywords from the PEPs themselves, but that would 
again preclude anyone but committers from defining the topics.

I brought up the index on the core-mentorship list in April and got a favorable 
response from Guido and Nick.

Nick: Indeed, a very good idea.  The wiki is probably a good place for it 
(since it will need to be manually maintained, and there's no reason to 
restrict that privilege to core devs) and a link in PEP 0 to the wiki page 
would be easy to do.

--

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



[issue8093] IDLE processes don't close

2011-06-21 Thread Simon

Simon simon.buchan...@gmail.com added the comment:

Not sure if this is related, but for me none of the F5 processes (command line 
pythonw.exe -c __import__('idlelib.run').run.main(True) num) ever exit on 
either 2.7.2 or 3.2.1rc1.

--
nosy: +Simon

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



[issue12379] build outside source fail in head

2011-06-21 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

Benjamin: The mentioned commit is yours, so you probably have the best 
understanding of this change.

--
nosy: +benjamin.peterson

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