[issue23099] BytesIO and StringIO values unavailable when closed

2015-01-05 Thread Martin Panter

Martin Panter added the comment:

Updated patch, to also document the BytesIO buffer is no longer available when 
closed. The StringIO documentation actually already says this, but I rarely use 
StringIO. :)

--
Added file: 
http://bugs.python.org/file37611/bytesio_exported_reject_close.v2.patch

___
Python tracker 

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



[issue23132] Faster total_ordering

2015-01-05 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue19548] 'codecs' module docs improvements

2015-01-05 Thread Martin Panter

Martin Panter added the comment:

Adding patch v5, for the 3.4 branch. There is at least one reference that still 
needs fixing in the default branch that is not applicable to the 3.4 branch. 
Main changes from Nick’s patch:

* Removed sentence now redundant with introduction to open() and EncodedFile()
* Fixed wording to allow for missing surrogateescape_errors() etc
* Changed heading to clarify Codec objects are stateless
* Restored relaxation for StreamWriter writing to text stream
* New wording under “Encodings and Unicode”
* Update cross references to new “Error Handlers” section

--
Added file: 
http://bugs.python.org/file37610/issue19548-codecs-doc.v5.py3.4.patch

___
Python tracker 

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



[issue23132] Faster total_ordering

2015-01-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 09b0da38ce8d by Raymond Hettinger in branch '3.4':
Issue #23132: Mitigate regression in speed and clarity in 
functools.total_ordering.
https://hg.python.org/cpython/rev/09b0da38ce8d

--

___
Python tracker 

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



[issue23176] socket.recvfrom(0) waits for data

2015-01-05 Thread Sworddragon

Sworddragon added the comment:

If there is no real use for socket.recvfrom(0) (and then probably 
socket.recv(0) too) maybe a bufsize argument of 0 should throw an exception?

--

___
Python tracker 

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



[issue23176] socket.recvfrom(0) waits for data

2015-01-05 Thread Benjamin Peterson

Benjamin Peterson added the comment:

That's not surprising, since revcfrom uses select() on the socket regardless of 
the value its argument. I'm not sure what the use of calling revcfrom(0) is.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue23171] csv.writer.writerow() does not accept generator (must be coerced to list)

2015-01-05 Thread Jon Dufresne

Jon Dufresne added the comment:

I have created an initial patch such that writerow() now allows generators. I 
have also added a unit test to demonstrate the fix.

The code now coerces iterators (and generators) to a list, then operates on the 
result. I would have preferred to simply iterate over the argument, however, 
there is a special case where the length of the argument is exactly 1. So 
coercing to a list makes checking the length simpler.

All feedback welcome.

--
keywords: +patch
Added file: http://bugs.python.org/file37609/csv-gen.patch

___
Python tracker 

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



[issue23176] socket.recvfrom(0) waits for data

2015-01-05 Thread Sworddragon

New submission from Sworddragon:

For example on sending ICMP packets and receiving the data socket.recv(1) does 
wait for data while socket.recv(0) doesn't. socket.recvfrom(1) does wait for 
data too but I'm also seeing that socket.recvfrom(0) is waiting for data which 
doesn't look correct (at least it seems not to be consistent with 
socket.recv()).

--
components: Library (Lib)
messages: 233500
nosy: Sworddragon
priority: normal
severity: normal
status: open
title: socket.recvfrom(0) waits for data
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue23174] shelve.open fails with error "anydbm.error: db type could not be determined"

2015-01-05 Thread Karl Richter

Karl Richter added the comment:

Then, let the error message say "You are opening a just-created empty file.  
The db type of the file cannot, therefore, be determined." which is much 
clearer than "anydbm.error: db type could not be determined" which sounds like 
a generic fallback error message in "an error occured"-style.

It seems to be necessary that the filename passed to `shelve.open` has a suffix 
which is not very intuitive for Linux users. It'd be great to have validation 
of the suffix and raise a `ValueError` with an error message like `"filename 
'%s' doesn't contain a suffix" % (filename,)` when it isn't supplied. If 
there's another issue regarding the fact that the file is "just-created" and 
empty, this is independent of the issue above.

--

___
Python tracker 

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



[issue23174] shelve.open fails with error "anydbm.error: db type could not be determined"

2015-01-05 Thread R. David Murray

R. David Murray added the comment:

Sorry, I mean "an empty file with no recognized extension".  I doubt supplying 
a suffix is what you want, though, since you probably want shelve to pick the 
persistent backend on db creation in order to be portable.

--

___
Python tracker 

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



[issue23174] shelve.open fails with error "anydbm.error: db type could not be determined"

2015-01-05 Thread R. David Murray

R. David Murray added the comment:

You are opening a just-created empty file.  The db type of the file cannot, 
therefore, be determined.  Which is what the error message says. 

How would you suggest the error message be improved?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue23175] logging.exception doesn't accept custom exc_info

2015-01-05 Thread Laimis

New submission from Laimis:

Documentation says, that "The arguments are interpreted as for debug()." But 
it's not true, because no matter what exc_info is passed to 
logging.exception(), exc_info is overwritten (kwargs['exc_info'] = 1) and later 
self.error is called. 
This is either documentation issue or behavior issue, because in the current 
implementation it's not possible to pass custom exc_info (e.g. full traceback) 
to logging.exception(), although documentation implies it should work the same 
as for info, warning, error, debug and others.

--
components: Library (Lib)
messages: 233496
nosy: laimis
priority: normal
severity: normal
status: open
title: logging.exception doesn't accept custom exc_info
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue22428] asyncio: KeyboardInterrupt inside a coroutine causes AttributeError

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

A lot of fixes has been commited to fix this general issue with asyncio at exit.

run_until_complete() doesn't log an error anymore when a BaseException (like 
KeyboardInterrupted) is raised. The caller is able to decide how to handle it.

The traceback module has been enhanced to try to fix the "AttributeError: 
'module' object has no attribute 'open'" error (or at least reduce the risk of 
such error). A better solution is being developed.

The initial issue was fixed, I close the issue. Thanks for the report Jack. 
Sorry, I forgot to update this issue since it was splitted in many smaller and 
more specific issues.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue22696] Add a function to know about interpreter shutdown

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

> Using the function in the stdlib can be done separately.

Is there an open issue for that?

--

___
Python tracker 

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



[issue23140] InvalidStateError on asyncio subprocess task cancelled

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

Thanks Xavier for the bug report, it should now be fixed.

Sorry, I don't see any workaround right now (except of using the development 
version of Tulip).

> The patch looks good, although the test feels overly complex (but maybe I'm 
> missing something).

Oh, I commited the change before seeing that you posted a review on Rietveld.

I modified the unit test to simplify it, the new code is enough to trigger the 
bug.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue23140] InvalidStateError on asyncio subprocess task cancelled

2015-01-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 990ce80d8283 by Victor Stinner in branch '3.4':
Issue #23140, asyncio: Simplify the unit test
https://hg.python.org/cpython/rev/990ce80d8283

--

___
Python tracker 

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



[issue23140] InvalidStateError on asyncio subprocess task cancelled

2015-01-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7c9b9d2514bb by Victor Stinner in branch '3.4':
Issue #23140, asyncio: Fix cancellation of Process.wait(). Check the state of
https://hg.python.org/cpython/rev/7c9b9d2514bb

--
nosy: +python-dev

___
Python tracker 

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



[issue23174] shelve.open fails with error "anydbm.error: db type could not be determined"

2015-01-05 Thread Karl Richter

Karl Richter added the comment:

EDIT 1: other examples, e.g.

import os
import shelve

curdir = os.path.dirname(__file__)
passwords = shelve.open(os.path.join(curdir, 'password_db'))

work, so there's need for usable error messages.

--

___
Python tracker 

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



[issue23046] asyncio.BaseEventLoop is documented, but only exported via asyncio.base_events

2015-01-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ddf6b78faed9 by Victor Stinner in branch '3.4':
Issue #23046: Expose the BaseEventLoop class in the asyncio namespace
https://hg.python.org/cpython/rev/ddf6b78faed9

--
nosy: +python-dev

___
Python tracker 

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



[issue23174] shelve.open fails with error "anydbm.error: db type could not be determined"

2015-01-05 Thread Karl Richter

New submission from Karl Richter:

`shelve.open(tempfile.mkstemp()[1])` fails with error "anydbm.error: db type 
could not be determined" which is not explainable with the docs. Traceback is

Traceback (most recent call last):
  File "./cudaminer_param_checker.py", line 720, in 
plac.call(cudaminer_param_checker)
  File "/usr/local/lib/python2.7/dist-packages/plac_core.py", line 309, in 
call
cmd, result = parser_from(obj).consume(arglist)
  File "/usr/local/lib/python2.7/dist-packages/plac_core.py", line 195, in 
consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
  File "./cudaminer_param_checker.py", line 715, in cudaminer_param_checker
visualize_cudaminer_param_checker_results_wxpython_gui()
  File "./cudaminer_param_checker.py", line 365, in 
visualize_cudaminer_param_checker_results_wxpython_gui
frame = CudaminerParamChecker(None, )
  File "./cudaminer_param_checker.py", line 378, in __init__
self.generator = CudaminerParamCheckerGenerator()
  File "./cudaminer_param_checker.py", line 160, in __init__
self.result_dict= shelve.open(storage_file_path) 
  File "/usr/lib/python2.7/shelve.py", line 239, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
  File "/usr/lib/python2.7/shelve.py", line 223, in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
  File "/usr/lib/python2.7/anydbm.py", line 82, in open
raise error, "db type could not be determined"
anydbm.error: db type could not be determined

--
assignee: docs@python
components: Documentation
messages: 233488
nosy: docs@python, krichter
priority: normal
severity: normal
status: open
title: shelve.open fails with error "anydbm.error: db type could not be 
determined"
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue23140] InvalidStateError on asyncio subprocess task cancelled

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

> I'm okay with leaving the other unguarded set_result() call unchanged, but 
> I'm also okay with putting "if not self.waiter.cancelled():" around it.

While playing with asyncio to try to inject errors on this code path, I found 
even more severe issues: see the issue #23173 which proposes to fix them.

--

___
Python tracker 

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



[issue23173] asyncio: kill the subprocess if the creation failed

2015-01-05 Thread STINNER Victor

New submission from STINNER Victor:

The creation of a subprocess in asyncio is complex, it is composed of multiple 
steps (callbacks scheduled by call_soon, coroutines, etc.). The creation can 
fail because of different reasons. I guess that the most common reason is a 
cancellation of a task, explicitly or because of a timeout (asyncio.wait_for).

I propose to ensure that everything is cleaned up on failure, especially to 
kill the subprocess. This choice comes from the subprocess module, it kills the 
subprocess on error.

Attached patch implements this change. It also fixes a bug noticed in the issue 
#23140: a call to waiter.set_result() in 
SubprocessStreamProtocol.connection_made() is not protected by a test on the 
future state.

When I wrote the unit tests, I tried to mock subprocess.Popen to ensure that 
the Popen.kill() method is called, but mocking a subprocess for asyncio is 
complex. I chose to keep the test simple.

--
components: asyncio
files: asyncio_subprocess_kill.patch
keywords: patch
messages: 233486
nosy: gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: kill the subprocess if the creation failed
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file37608/asyncio_subprocess_kill.patch

___
Python tracker 

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



[issue23086] Add start and stop parameters to the Sequence.index() ABC mixin method

2015-01-05 Thread Devin Jeanpierre

Devin Jeanpierre added the comment:

A wild patch appears!

Test is included, I'm unhappy with it, because it uses one test method to test 
all of Sequence, but that's what the test suite does for MutableSequence.

--
keywords: +patch
nosy: +Devin Jeanpierre
Added file: http://bugs.python.org/file37607/issue23086.patch

___
Python tracker 

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



[issue23166] urllib2 ignores opener configuration under certain circumstances

2015-01-05 Thread Benjamin Peterson

Benjamin Peterson added the comment:

I guess there needs to be some generic way to pass ssl information to handlers.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue23140] InvalidStateError on asyncio subprocess task cancelled

2015-01-05 Thread Guido van Rossum

Guido van Rossum added the comment:

The patch looks good, although the test feels overly complex (but maybe I'm 
missing something).

I'm okay with leaving the other unguarded set_result() call unchanged, but I'm 
also okay with putting "if not self.waiter.cancelled():" around it.

--

___
Python tracker 

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



[issue23046] asyncio.BaseEventLoop is documented, but only exported via asyncio.base_events

2015-01-05 Thread Guido van Rossum

Guido van Rossum added the comment:

Sure. I already said LGTM on the patch 
(http://bugs.python.org/issue23046#msg232783).

--

___
Python tracker 

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



[issue23046] asyncio.BaseEventLoop is documented, but only exported via asyncio.base_events

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

What do you think of my first change, base_event_loop.patch, which exposes 
BaseEventLoop? I'm going to commit it if nobody reviews it.

--

___
Python tracker 

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



[issue23140] InvalidStateError on asyncio subprocess task cancelled

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

Oh no. My comment was not published, it was probably an issue with my unstable 
Internet connection.

Here is a patch fixing the issue with an unit test.

There is another call to Future.set_result() in subprocess.py not protected by 
an if in connection_made(). I don't know if it should be patched too or not.

--
keywords: +patch
Added file: 
http://bugs.python.org/file37606/asyncio_subprocess_cancel_wait.patch

___
Python tracker 

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



[issue23172] Bad file descriptor error occurs if random library is imported before closing FDs

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

This issue is a duplicate of the issue #21207 which was already fixed in Python 
3.4.1.

--
nosy: +haypo
resolution:  -> duplicate
status: open -> closed
superseder:  -> urandom persistent fd - not re-openned after fd close

___
Python tracker 

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



[issue23172] Bad file descriptor error occurs if random library is imported before closing FDs

2015-01-05 Thread Wayne Song

New submission from Wayne Song:

The following script:

import os
import resource
import random

print("1")

for fd in range(resource.getrlimit(resource.RLIMIT_NOFILE)[0]):
try:
if fd not in range(0, 3):
os.close(fd)
except os.error:
pass

print("2")
print(os.urandom(32))
print("3")

Crashes with the following output:

1
2
Traceback (most recent call last):
  File "test.py", line 17, in 
print(os.urandom(32))
OSError: [Errno 9] Bad file descriptor

On an Ubuntu 14.04 install (in VirtualBox).  It seems to run correctly on Mac 
OS X.  The script runs fine if I don't import random at the top.

--
components: Library (Lib)
messages: 233478
nosy: waynesong
priority: normal
severity: normal
status: open
title: Bad file descriptor error occurs if random library is imported before 
closing FDs
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue23166] urllib2 ignores opener configuration under certain circumstances

2015-01-05 Thread Jurijs Vorotilovs

Jurijs Vorotilovs added the comment:

Attached a script demonstrating two failing cases

--
Added file: http://bugs.python.org/file37605/test.py

___
Python tracker 

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



[issue23160] Respect the environment variable SVNROOT in external-common.bat

2015-01-05 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
stage:  -> patch review

___
Python tracker 

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



[issue23160] Respect the environment variable SVNROOT in external-common.bat

2015-01-05 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +steve.dower

___
Python tracker 

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



[issue14134] xmlrpc.client.ServerProxy needs timeout parameter

2015-01-05 Thread Demian Brecht

Demian Brecht added the comment:

I withdraw my patch as (I just discovered), it is already possible to effect 
changes to the underlying connection. What /should/ be done is:

transport = Transport()
con = transport.make_connection([host])
con.timeout = 2

proxy = ServerProxy([url], transport=transport)

As the connection will not be created until an RPC method is called, the 
timeout value assigned to the connection will be observed on socket creation. 
Making such modifications to the underlying transport should be documented.

That said, what is a little less than optimal is that the transport attribute 
of a ServerProxy object is inaccessible (without hackery) after instantiation, 
so socket level changes are impossible if not using a custom transport. What 
would be nice would be to add an accessor for ServerProxy.__transport. 
Likewise, Transport._connection is marked as part of the private interface. 
Adding public accessors would allow for something like this:

proxy = ServerProxy([url])
# pre-connect timeout
proxy.transport.connection.timeout = 2
proxy.system.listMethods()

or 

proxy = ServerProxy([url])
proxy.system.listMethods()
# socket is available as connection has been established
proxy.transport.connection.sock.settimeout(2)

--

___
Python tracker 

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



[issue14134] xmlrpc.client.ServerProxy needs timeout parameter

2015-01-05 Thread Demian Brecht

Changes by Demian Brecht :


Removed file: http://bugs.python.org/file37481/issue14134.patch

___
Python tracker 

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



[issue23171] csv.writer.writerow() does not accept generator (must be coerced to list)

2015-01-05 Thread R. David Murray

R. David Murray added the comment:

This seems like a sensible enhancement request to me.

It is possible it could even be considered a bug, the docs aren't exactly clear 
on what 'row' is expected to be.

--
keywords: +easy
nosy: +r.david.murray
stage:  -> needs patch
type: behavior -> enhancement
versions: +Python 3.5 -Python 3.3

___
Python tracker 

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



[issue23170] test_uuid test_ifconfig_getnode fails with Temporary failure in name resolution

2015-01-05 Thread R. David Murray

R. David Murray added the comment:

Ah, I see what happened.  Serhiy split _ifconfig_getnode, so when I did an hg 
annotate it looked like _ifconfig_getnode was untouched, but in fact it had 
been split to create the _arp_getnode function.

So, this report is out of date, this has already been fixed in 3.4.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue17293] uuid.getnode() MAC address on AIX

2015-01-05 Thread Dimitri John Ledkov

Dimitri John Ledkov added the comment:

I'm getting socket.gaierror from test_ifconfig_getnode / 
uuid._ifconfig_getnode() on python 3.4.2 on Linux, in a no network environment. 
Thus i'd like to see these try:/excepts: to be ported back to 3.4 branch, if 
they haven't been already.

I filed http://bugs.python.org/issue23170 to track my issue.

Feel free to close that one as a (related) dupe of this one.

--
nosy: +xnox

___
Python tracker 

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



[issue23170] test_uuid test_ifconfig_getnode fails with Temporary failure in name resolution

2015-01-05 Thread Dimitri John Ledkov

Dimitri John Ledkov added the comment:

I guess this is related to http://bugs.python.org/issue17293 however I get a 
test-suite fail / exception there with 3.4.2 on Linux.

--

___
Python tracker 

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



[issue23170] test_uuid test_ifconfig_getnode fails with Temporary failure in name resolution

2015-01-05 Thread Dimitri John Ledkov

Dimitri John Ledkov added the comment:

The source code matches 3.4.2 tarball exactly.

There is no arp_getnode test that I can see.

316@unittest.skipUnless(os.name == 'posix', 'requires Posix')
317def test_ifconfig_getnode(self):
318node = uuid._ifconfig_getnode()
319if node is not None:
320self.check_node(node, 'ifconfig')


346def _ifconfig_getnode():
347"""Get the hardware address on Unix by running ifconfig."""
348
349# This works on Linux ('' or '-a'), Tru64 ('-av'), but not all Unixes.   

 
350for args in ('', '-a', '-av'):
351mac = _find_mac('ifconfig', args, ['hwaddr', 'ether'], lambda i: i+1)
352if mac:
353return mac
354
355import socket
356ip_addr = socket.gethostbyname(socket.gethostname())
357
358# Try getting the MAC addr from arp based on our IP address (Solaris).   

 
359mac = _find_mac('arp', '-an', [ip_addr], lambda i: -1)
360if mac:
361return mac
362
363# This might work on HP-UX.  

 
364mac = _find_mac('lanscan', '-ai', ['lan0'], lambda i: 0)
365if mac:
366return mac
367
368return None


And I do not see any try/except protections around it.

--

___
Python tracker 

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



[issue23171] csv.writer.writerow() does not accept generator (must be coerced to list)

2015-01-05 Thread Jon Dufresne

New submission from Jon Dufresne:

The csv.writer.writerow() does not accept a generator as input. I find this 
counter-intuitive and against the spirit of similar APIs. If the generator is 
coerced to a list, everything works as expected. See the following test script 
which fails on the line "w.writerow(g)". In my opinion, this line should work 
identically to the line "w.writerow(list(g))".

---
import csv

f = open('foo.csv', 'w')
w = csv.writer(f)
g = (i for i in ['a', 'b', 'c'])
w.writerow(list(g))
g = (i for i in ['a', 'b', 'c'])
w.writerow(g)
---

--
components: Library (Lib)
messages: 233470
nosy: jdufresne
priority: normal
severity: normal
status: open
title: csv.writer.writerow() does not accept generator (must be coerced to list)
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue23170] test_uuid test_ifconfig_getnode fails with Temporary failure in name resolution

2015-01-05 Thread R. David Murray

R. David Murray added the comment:

That traceback doesn't match the uuid.py source, nor has _ifconfig_getnode been 
modified for quite some time.  A line like your traceback says is in 
_ifconfig_getnode actually appears in _arp_getnode.  The arp_getnode test would 
presumably have the same problem, since it is also not protected by either; 
however, that call to socket in uuid.py, which is the only such call in the 
file, is protected by a try/except for OSError, so no error should be bubbling 
up from it.

Can you investigate further, please?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue9303] Migrate sqlite3 module to _v2 API to enhance performance

2015-01-05 Thread Gerhard Häring

Gerhard Häring added the comment:

ok, i will have to look into this

--

___
Python tracker 

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



[issue23170] test_uuid test_ifconfig_getnode fails with Temporary failure in name resolution

2015-01-05 Thread Dimitri John Ledkov

New submission from Dimitri John Ledkov:

Building 3.4.2, running testsuite on linux,
test_uuid test_ifconfig_getnode fails as following:

[365/388] test_uuid
Warning -- sys.path was modified by test_site
test test_uuid failed -- Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.4.2/Lib/test/test_uuid.py", line 318, in 
test_ifconfig_getnode
node = uuid._ifconfig_getnode()
  File "/builddir/build/BUILD/Python-3.4.2/Lib/uuid.py", line 356, in 
_ifconfig_getnode
ip_addr = socket.gethostbyname(socket.gethostname())
socket.gaierror: [Errno -3] Temporary failure in name resolution

Note that "Use of the 'network' resource not enabled"

--
components: Installation
messages: 233467
nosy: xnox
priority: normal
severity: normal
status: open
title: test_uuid test_ifconfig_getnode fails with Temporary failure in name 
resolution
type: compile error
versions: Python 3.4

___
Python tracker 

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



[issue20898] Missing 507 response description

2015-01-05 Thread Berker Peksag

Berker Peksag added the comment:

LGTM. Great patch, thanks!

--
assignee:  -> berker.peksag

___
Python tracker 

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



[issue9303] Migrate sqlite3 module to _v2 API to enhance performance

2015-01-05 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy: +BreamoreBoy

___
Python tracker 

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



[issue15795] Zipfile.extractall does not preserve file permissions

2015-01-05 Thread R. David Murray

Changes by R. David Murray :


--
stage: patch review -> commit review

___
Python tracker 

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



[issue20898] Missing 507 response description

2015-01-05 Thread Demian Brecht

Demian Brecht added the comment:

The attached patch is a rework of the http.HTTPStatus docs to include links to 
the RFCs. While working through this, I noticed that I may have been a little 
overzealous in inclusion of some of the status codes. Some non-standard codes 
have been deprecated or collide between vendors. As such, I've removed 
non-standard codes. The only ones supported are those that are IANA-registered 
(including experimental codes). This is to reduce the chance of future 
conflicts. These were only recently added for 3.5 and therefore should not 
cause any backwards compatibility issues.

--
Added file: http://bugs.python.org/file37604/issue20898.patch

___
Python tracker 

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



[issue9303] Migrate sqlite3 module to _v2 API to enhance performance

2015-01-05 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue9634] Add timeout parameter to Queue.join()

2015-01-05 Thread Swen Wenzel

Swen Wenzel added the comment:

I have another use case.
The Docs use the producer-consumer pattern as a usage example.
I'm also using this pattern but apparently the consumers are not that stable 
during development phase.

So if one of your consumers dies during execution of its task, before it can 
say 'task done', then you will have a deadlock.
You could of course avoid this by adding a finally block which will claim the 
task is done even if there was some error or exception but then you will lie to 
the producer!
And suppose you only have one consumer and there are still tasks waiting (which 
is the case for my application), then you'll still have a deadlock since nobody 
is there to execute the remaining tasks.
This could be solved by putting the exception handling within the consumer's 
mainloop like this:

Consumer(Thread):
def __init__(self, queue):
self.queue = queue

def run():
while True:
task = self.queue.get()
try:
# execute task
except:
# handle exception (hopefully) without reraising one
finally:
self.queue.task_done()

This way, however, the producer won't notice any issues unless the consumer's 
exception handler sets a flag or puts the exception into a collection that can 
be checked by the producer.

But even that is no solution if the consumer executes a task with an endless 
loop or runs into a deadlock itself.

I would propose to throw an exception if queue.Queue.join() returns because of 
a timeout since then you can investigate the cause within the exception handler 
and do not have to check for the consumer's status after each join(). But this 
is microoptimization so I would also be satisfied with the same solution as for 
threading.Thread.join().

--
nosy: +Swen.Wenzel

___
Python tracker 

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



[issue9303] Migrate sqlite3 module to _v2 API to enhance performance

2015-01-05 Thread Dima Tisnek

Dima Tisnek added the comment:

Is there any hope?
Surely sqlite backwards compatibility is not an issue any longer...

--
nosy: +Dima.Tisnek

___
Python tracker 

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



[issue23169] Reflect that PreReq and BuildPreReq are deprecated in the latest RPM

2015-01-05 Thread Radek Simko

New submission from Radek Simko:

When I try to make custom package of Python 2.7, I use the spec file attached 
in `/Misc/RPM`. I don't really use it to build Python as I want to define some 
specific options, but I do use it as a source of RPM package meta data which I 
can simply reuse when creating the final RPM, e.g.:

rpm -q --specfile ./Misc/RPM/python-2.7.spec --queryformat '%{DESCRIPTION}'

Manipulation with that specfile in RPM 4.4.2.3 (CentOS 5.6) is fine, but there 
are warnings in RPM 4.8.0 (CentOS 6.5):

warning: line 71: buildprereq is deprecated: BuildPrereq: expat-devel
warning: line 72: buildprereq is deprecated: BuildPrereq: db4-devel
warning: line 73: buildprereq is deprecated: BuildPrereq: gdbm-devel
warning: line 74: buildprereq is deprecated: BuildPrereq: sqlite-devel
warning: line 91: prereq is deprecated: Prereq: python2.6 = %{PACKAGE_VERSION}
warning: line 122: prereq is deprecated: Prereq: python2.6 = 
%{PACKAGE_VERSION}-1pydotorg

Here's related thread: 
https://groups.google.com/forum/#!topic/comp.lang.python/R8ahiZ5wyhc
and most importantly here's proof/explanation: 
http://www.rpm.org/wiki/Releases/4.8.0#Packagebuilding

 - PreReq and BuildPreReq are now officially deprecated, with warnings at 
build-time
 - PreReq is mapped to Requires(pre,preun) at build-time

Requires(pre,preun) is backwards compatible, so it works in RPM 4.4 too, I 
would therefore suggest to change "[Build]Prereq" to 
"[Build]Requires(pre,preun)" respectively in the specfile to reflect this.

I'm happy to send a patch if some maintainers will agree with proposed solution.

--
components: Build
messages: 233462
nosy: radeksimko
priority: normal
severity: normal
status: open
title: Reflect that PreReq and BuildPreReq are deprecated in the latest RPM
type: enhancement
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



[issue23168] test_file2k.py depends on sys.stdin being unseekable

2015-01-05 Thread Dimitri John Ledkov

Dimitri John Ledkov added the comment:

> Removing a test when it doesn't pass is not the correct way to fix a test...

Whilst I agree, this is not what was done in http://bugs.python.org/issue14853 
. There it was concluded that the test itself is bogus and tests essentially 
nothing.

--

___
Python tracker 

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



[issue23168] test_file2k.py depends on sys.stdin being unseekable

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

Removing a test when it doesn't pass is not the correct way to fix a test...

I would be better to write it differently to support seekable stdin. Or if it 
doesn't make sense, skip the test if stdin is seeable.

--
nosy: +haypo

___
Python tracker 

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



[issue23168] test_file2k.py depends on sys.stdin being unseekable

2015-01-05 Thread Dmitrijs Ledkovs

Changes by Dmitrijs Ledkovs :


--
keywords: +patch
Added file: http://bugs.python.org/file37603/issue23168.patch

___
Python tracker 

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



[issue23168] test_file2k.py depends on sys.stdin being unseekable

2015-01-05 Thread Dmitrijs Ledkovs

Changes by Dmitrijs Ledkovs :


--
components: +Installation
versions: +Python 2.7

___
Python tracker 

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



[issue23168] test_file2k.py depends on sys.stdin being unseekable

2015-01-05 Thread Dmitrijs Ledkovs

New submission from Dmitrijs Ledkovs:

# LD_LIBRARY_PATH=`pwd` ./python Lib/test/regrtest.py test_file2k http://bugs.python.org/issue14853

--
messages: 233459
nosy: xnox
priority: normal
severity: normal
status: open
title: test_file2k.py depends on sys.stdin being unseekable

___
Python tracker 

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

I would be nice to share as much code as possible with the Unicode 
implementation. My idea was to add a "_PyBytesWriter" API, very close to the 
"_PyUnicodeWriter", to share code. Old patch implementing the _PyBytesWriter 
API: issue #17742 (rejected because it was less efficient, the compiler 
produces less efficient machine code).

--

___
Python tracker 

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



[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2015-01-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I prefer the current code (i.e. formatter_fix_resource_warning_v5.patch).

In more complex case ExitStack can be used, but here it looks redundant.

with contextlib.ExitStack() as stack:
if some_test:
fl = open(sys.argv[1])
stack.enter_context(fl)
else:
fl = sys.stdin
do_stuff(fl)

or

if some_test:
cm = fl = open(sys.argv[1])
else:
fl = sys.stdin
cm = contextlib.ExitStack()
with cm:
do_stuff(fl)

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2015-01-05 Thread Eric V. Smith

Eric V. Smith added the comment:

Good point on contextlib.closing not being needed. I usually use this pattern 
on things that aren't files!

On second thought, the with statement will close sys.stdin, so this isn't a 
valid pattern here. Sorry for the noise.

--

___
Python tracker 

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

Hi. I proposed twice to Ethan to implement the PEP 461, but he replied that he 
wants to implement it. So, what's the status of the implementation?

--

___
Python tracker 

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



[issue20487] Odd words in unittest.mock document.

2015-01-05 Thread Michael Foord

Michael Foord added the comment:

Patch looks good, thanks.

--

___
Python tracker 

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



[issue20487] Odd words in unittest.mock document.

2015-01-05 Thread Berker Peksag

Berker Peksag added the comment:

Here is a patch to address msg211296.

--
keywords: +patch
nosy: +berker.peksag
stage:  -> patch review
type:  -> enhancement
versions:  -Python 3.3
Added file: http://bugs.python.org/file37602/issue20487.diff

___
Python tracker 

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



[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

> fl = contextlib.closing(open(sys.argv[1]))

I prefer the current code with the explicit close() and "is not sys.stdin", 
it's less magic :-)

--

___
Python tracker 

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



[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2015-01-05 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the suggestion, Eric. contextlib.closing(open(...)) looks 
unnecessary to me. Here is an alternative patch.

--
Added file: http://bugs.python.org/file37601/issue18644.diff

___
Python tracker 

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



[issue22619] Possible implementation of negative limit for traceback functions

2015-01-05 Thread Dmitry Kazakov

Dmitry Kazakov added the comment:

I understand that this issue is far from being important, but this is going to 
be the fourth unreviewed file in this issue. I noted all your comments to me 
and fixed the patch accordingly, but ever since November I'm the only one who 
posts something here. I pinged the issue about 4 days ago (after a month of 
utter silence) and still didn't get any response. Could someone review the 
latest patch (the one I attach to this message - traceback_rev.diff) or at 
least say what's wrong with it (or with this issue, or with something else)?

--
Added file: http://bugs.python.org/file37600/traceback_rev.diff

___
Python tracker 

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



[issue22165] Empty response from http.server when directory listing contains invalid unicode

2015-01-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1bc41bbbe02d by Ned Deily in branch '3.4':
Issue #22165: Skip test_undecodable_filename on OS X prior to 10.5.
https://hg.python.org/cpython/rev/1bc41bbbe02d

New changeset 85258e08b69b by Ned Deily in branch 'default':
Issue #22165: merge from 3.4
https://hg.python.org/cpython/rev/85258e08b69b

--

___
Python tracker 

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



[issue3786] _curses, _curses_panel & _multiprocessing can't be build in 2.6b3 w/ SunStudio 12

2015-01-05 Thread noon

Changes by noon :


--
nosy:  -noon

___
Python tracker 

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



[issue22935] Disabling SSLv3 support

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

I'm going to commit get_server_certificate_sslv23.patch into Python 3.4, so 
Python 3.4 will just behave like Python 2.7 and 3.5, except if someone 
complains :-)

--

___
Python tracker 

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



[issue22935] Disabling SSLv3 support

2015-01-05 Thread Ned Deily

Ned Deily added the comment:

Setting to release blocker since this needs to be resolved for 3.4.3.  FYI, the 
OS X x86 Tiger 3.4 buildbot has been updated to use a local copy of OpenSSL 
1.0.1j with SSLv3 disabled and multiple tests now fail (2.7 and default do not 
fail, as expected).

http://buildbot.python.org/all/builders/x86%20Tiger%203.4

--
nosy: +larry
priority: high -> release blocker

___
Python tracker 

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



[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2015-01-05 Thread Eric V. Smith

Eric V. Smith added the comment:

Not that I think it's worth changing for this case, but I find code like this 
better written as:

if some_test:
fl = contextlib.closing(open(sys.argv[1]))
else:
fl = sys.stdin
with fl as fl:
do_stuff(fl)

This way you don't need another test, the close isn't far away from the open, 
and you save some lines of boilerplate.


Or, if "with fl as fl" bothers you:

with sys.stdout if some_test else contextlib.closing(open(sys.argv[1])) as fl:
do_stuff(fl)

I don't recommend that, though.

In any event, thanks for the fix!

--
nosy: +eric.smith

___
Python tracker 

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



[issue15795] Zipfile.extractall does not preserve file permissions

2015-01-05 Thread ABR

ABR added the comment:

I hope this can be finally gotten in for 3.5, even if it's not the perfect 
solution.  I hit this issue and needed to call out to a subprocess as a 
work-around, but that's far less reliable.

--
nosy: +arobert

___
Python tracker 

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