[issue18743] References to non-existant StringIO module

2013-08-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee: docs@python - serhiy.storchaka

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



[issue14191] argparse doesn't allow optionals within positionals

2013-08-16 Thread Glenn Linderman

Glenn Linderman added the comment:

Paul, is this ready to merge, or are you thinking of more refinements?

--

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



[issue18738] String formatting (% and str.format) issues with Enum

2013-08-16 Thread Ethan Furman

Ethan Furman added the comment:

Eric, please do not feel your time has been wasted.  I greatly appreciate the 
knowledge you shared and I learned much.

I feel very strongly that, as much as possible, an Enum should Just Work.  
Requiring users to write their own __format__ any time they create a new 
mixinEnum in order to get sane default behaviour is just not cool.

And while the behaviour of switching from str.__format__ to mixin.__format__ 
can appear a bit magical, it is nothing compared to Enum as a whole.

You can review the attached patch to see what I mean about filtering the format 
spec to decide which __format__ method to call.  Any code besides the basic 
width and justification codes will switch to the mix-in's __format__; so '+', 
'b', '%Y', 's', and everything we haven't thought of yet will switch to mix-in.

--
keywords: +patch
stage:  - patch review
Added file: http://bugs.python.org/file31310/issue18738.stoneleaf.01.patch

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



[issue18738] String formatting (% and str.format) issues with Enum

2013-08-16 Thread Ethan Furman

Ethan Furman added the comment:

This patch contains the previous patch, plus a fix and tests for %i, %d, and %u 
formatting, and tests only for %f formatting (nothing to fix there, but don't 
want it breaking in the future ;) .

--
Added file: http://bugs.python.org/file31311/issue18738.stoneleaf.02.patch

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



[issue18753] [c]ElementTree.fromstring fails to parse value]]/value

2013-08-16 Thread Kees Bos

New submission from Kees Bos:

ElementTree.fromstring and cElementTree.fromstring fail on parsing
value]]/value, but do parse value]]gt;/value

$ python
Python 2.7.3 (default, Apr 10 2013, 05:09:49) 
[GCC 4.7.2] on linux2
Type help, copyright, credits or license for more information.
 from xml.etree import cElementTree as ET
 ET.fromstring(value]]/value).text
Traceback (most recent call last):
  File stdin, line 1, in module
  File string, line 124, in XML
cElementTree.ParseError: not well-formed (invalid token): line 1, column 9
 ET.fromstring(value]]gt;/value).text
']]'
 from xml.etree import ElementTree as ET
 ET.fromstring(value]]/value).text
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.7/xml/etree/ElementTree.py, line 1301, in XML
parser.feed(text)
  File /usr/lib/python2.7/xml/etree/ElementTree.py, line 1643, in feed
self._raiseerror(v)
  File /usr/lib/python2.7/xml/etree/ElementTree.py, line 1507, in _raiseerror
raise err
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, 
column 9
 ET.fromstring(value]]gt;/value).text
']]'


--
components: XML
messages: 195315
nosy: kees
priority: normal
severity: normal
status: open
title: [c]ElementTree.fromstring fails to parse value]]/value
type: behavior
versions: Python 2.7

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



[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-16 Thread Charles-François Natali

Charles-François Natali added the comment:

I've just had a quick look at the patch, but from what I can see, 
socket.getaddrinfo() will return a raw integer for the family, and not an 
AddressFamily instance. That's unfortunate.

--

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



[issue18643] implement socketpair() on Windows

2013-08-16 Thread Charles-François Natali

Charles-François Natali added the comment:

I was thinking about dropping the C wrapper from socketmodule.c, and
replacing it with a pure Python implementation (e.g. the one posted by
Richard on python-dev).
What do you think?

--

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



[issue16463] testConnectTimeout of test_timeout TCPTimeoutTestCasefailures fails intermittently

2013-08-16 Thread Charles-François Natali

Charles-François Natali added the comment:

Here's an updated patch using the lru_cache decorator.

--
Added file: http://bugs.python.org/file31312/connect_timeout-1.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16463
___diff -r 928d405fe2ad Lib/test/test_timeout.py
--- a/Lib/test/test_timeout.py  Sun Aug 04 15:35:57 2013 +0200
+++ b/Lib/test/test_timeout.py  Fri Aug 16 13:50:31 2013 +0200
@@ -1,5 +1,6 @@
 Unit tests for socket timeout feature.
 
+import functools
 import unittest
 from test import support
 
@@ -126,13 +127,24 @@
 self.assertLess(delta, timeout + self.fuzz)
 self.assertGreater(delta, timeout - 1.0)
 
+@functools.lru_cache()
+def resolve_address(self, host, port):
+Resolve an (host, port) to an address.
+
+We must perform name resolution before timeout tests, otherwise it will
+be performed by connect().
+
+with support.transient_internet(host):
+return socket.getaddrinfo(host, port, socket.AF_INET,
+  socket.SOCK_STREAM)[0][4]
+
 
 class TCPTimeoutTestCase(TimeoutTestCase):
 TCP test case for socket.socket() timeout functions
 
 def setUp(self):
 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-self.addr_remote = ('www.python.org.', 80)
+self.addr_remote = self.resolve_address('www.python.org.', 80)
 
 def tearDown(self):
 self.sock.close()
@@ -142,7 +154,7 @@
 # to a host that silently drops our packets.  We can't simulate this
 # from Python because it's a function of the underlying TCP/IP stack.
 # So, the following Snakebite host has been defined:
-blackhole = ('blackhole.snakebite.net', 5)
+blackhole = self.resolve_address('blackhole.snakebite.net', 5)
 
 # Blackhole has been configured to silently drop any incoming packets.
 # No RSTs (for TCP) or ICMP UNREACH (for UDP/ICMP) will be sent back
@@ -154,7 +166,7 @@
 # to firewalling or general network configuration.  In order to improve
 # our confidence in testing the blackhole, a corresponding 'whitehole'
 # has also been set up using one port higher:
-whitehole = ('whitehole.snakebite.net', 56667)
+whitehole = self.resolve_address('whitehole.snakebite.net', 56667)
 
 # This address has been configured to immediately drop any incoming
 # packets as well, but it does it respectfully with regards to the
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2013-08-16 Thread Charles-François Natali

Charles-François Natali added the comment:

Unfortunately, there's not much we can do about it: if dlsym() fails - which is 
the case here either because read() fails with EBADF, or because the file 
descriptor now points to another stream (i.e. not libgcc), the libc aborts 
(here upon pthread_exit(), not PyThread_delete_key()):

libgcc_s.so.1 must be installed for pthread_cancel to work

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb7b0eb70 (LWP 17152)]
0xb7fe1424 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb7e4e941 in *__GI_raise (sig=6) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0xb7e51d72 in *__GI_abort () at abort.c:92
#3  0xb7e8ae15 in __libc_message (do_abort=1, fmt=0xb7f606f5 %s) at 
../sysdeps/unix/sysv/linux/libc_fatal.c:189
#4  0xb7e8af44 in *__GI___libc_fatal (message=0xb7fc75ec libgcc_s.so.1 must be 
installed for pthread_cancel to work\n) at 
../sysdeps/unix/sysv/linux/libc_fatal.c:200
#5  0xb7fc4ffa in pthread_cancel_init () at 
../nptl/sysdeps/pthread/unwind-forcedunwind.c:65
#6  0xb7fc509d in _Unwind_ForcedUnwind (exc=0xb7b0edc0, stop=0xb7fc2bf0 
unwind_stop, stop_argument=0xb7b0e454) at 
../nptl/sysdeps/pthread/unwind-forcedunwind.c:126
#7  0xb7fc2b98 in *__GI___pthread_unwind (buf=optimized out) at unwind.c:130
#8  0xb7fbcce0 in __do_cancel () at pthreadP.h:265
#9  __pthread_exit (value=0x0) at pthread_exit.c:30
#10 0x08132ced in PyThread_exit_thread () at Python/thread_pthread.h:266
#11 0x08137c37 in t_bootstrap (boot_raw=0x8318aa8) at 
./Modules/_threadmodule.c:1023
#12 0xb7fbbc39 in start_thread (arg=0xb7b0eb70) at pthread_create.c:304
#13 0xb7ef978e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130


So if you're unlucky and end up closing the FD referring to libgcc used by 
dlopen/dlsym, you're pretty much screwed, and there's no way around this.

Note that you specific problem (upon PyThread_delete_key()) doesn't occur for 
python 2.7 because it uses and ad-hoc TLS implementation, whereas Python 3 uses 
the platform native TLS.
But as noted above, you can very well get an abort on pthread_exit(), and in 
likely many other places (pretty much everywhere libgcc can be dlopen'ed).

Unfortunately, we can't do much against this, so I'm tempted to close this as 
wont fix.

--
nosy: +neologix
stage:  - committed/rejected
status: open - pending

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



[issue18673] Add and use O_TMPFILE for Linux 3.11

2013-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f6034602410c by Christian Heimes in branch 'default':
Issue #18673: Add O_TMPFILE to os module. O_TMPFILE requires Linux kernel
http://hg.python.org/cpython/rev/f6034602410c

New changeset 815b7bb3b08d by Christian Heimes in branch 'default':
Issue #18673: Add versionchanged to docs
http://hg.python.org/cpython/rev/815b7bb3b08d

--
nosy: +python-dev

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Perhaps the only thing we could do would be try to preload libgcc by calling 
one of those APIs at startup? But I'm not sure it's a good idea to add such a 
platform-specific hack (for what is arguably an obscure and rare issue).

--
nosy: +pitrou
status: pending - open

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



[issue18673] Add O_TMPFILE to os module

2013-08-16 Thread Christian Heimes

Christian Heimes added the comment:

I have added O_TMPFILE to the os module.

I like to hold off with the actual use of O_TMPFILE in tempfile until Python 
3.5. The feature is too new and I don't have any way to test it. Some people 
have reported file system corruption in 3.11-rc4, too.

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
title: Add and use O_TMPFILE for Linux 3.11 - Add O_TMPFILE to os module

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2013-08-16 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue18368] PyOS_StdioReadline() leaks memory when realloc() fails

2013-08-16 Thread Christian Heimes

Changes by Christian Heimes li...@cheimes.de:


--
status: pending - closed

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



[issue18740] str is number methods don't recognize '.'

2013-08-16 Thread Ezio Melotti

Ezio Melotti added the comment:

 it seems try/except is still the best way.  :-/

Indeed: http://docs.python.org/dev/glossary#term-eafp

--
nosy: +ezio.melotti
stage:  - committed/rejected

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2013-08-16 Thread STINNER Victor

STINNER Victor added the comment:

Maries Ionel Cristian ubuntu 12.04.2

What is the version of your libc library? Try something like dpkg -l libc6.

--

Could this issue be related to this glibc issue?
http://sourceware.org/bugzilla/show_bug.cgi?id=2644

I ran your script on Python 3.4 in a shell loop: I'm unable to reproduce the 
issue. I'm running Fedora 18 with the glibc 2.16.

--

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2013-08-16 Thread STINNER Victor

STINNER Victor added the comment:

Oh ok, I'm able to reproduce the issue with the system Python 3.3:

$ while true; do echo loop; python3.3 bug.py || break; done
loop
...
loop
libgcc_s.so.1 must be installed for pthread_cancel to work
Abandon (core dumped)

--

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



[issue18750] '' % [1] doesn't fail

2013-08-16 Thread R. David Murray

R. David Murray added the comment:

Hmm.  The linked issue says the PyMappingCheck behavior is new in Python3, but 
this problem exists in Python2 (back to 2.4 at least) as well.  Perhaps it is a 
different bug in Python2.

--

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



[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-16 Thread Eli Bendersky

Eli Bendersky added the comment:

Great catch, Charles-François, thanks. It's actually an interesting example in 
favor of the approach - it's very nice to see descriptive family names in the 
data returned by getaddrinfo, instead of obtuse numeric values.

The attached patch fixes it in a similar vein to what was done for the family 
accessor: getaddrinfo is overridden in Python and does the necessary 
conversion. User code is unaffected. It has to rebuild the list (since those 
are tuples) but I don't think it matters in terms of performance for this 
specific function. As a bonus, getaddrinfo got a much nicer docstring :)



Note again that if this is acceptable, I'm going to similarly convert SOCK_* 
and post a full patch (with some documentation too).

--
Added file: http://bugs.python.org/file31313/socket-intenum-af.4.patch

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



[issue18753] [c]ElementTree.fromstring fails to parse value]]/value

2013-08-16 Thread R. David Murray

R. David Murray added the comment:

Why do you think this is a bug?  (You may well be right; I'm not familiar with 
the intricacies of XML. But on its face the behavior looks reasonable.)

--
nosy: +r.david.murray

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



[issue18750] '' % [1] doesn't fail

2013-08-16 Thread Eric V. Smith

Eric V. Smith added the comment:

The code looks basically the same in 2.7, and there PyMapping_Check looks for 
__getitem__, so maybe issue 5945 is just incorrect in its analysis.

In any event, I'm not sure this is worth fixing. There are lots of little 
corner cases that could be broken.

--

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



[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-16 Thread Eli Bendersky

Eli Bendersky added the comment:

Looks nice:

 for t in socket.getaddrinfo('www.google.com', 'http'):
...   t
... 
(AddressFamily.AF_INET: 2, 1, 6, '', ('74.125.239.112', 80))
(AddressFamily.AF_INET: 2, 2, 17, '', ('74.125.239.112', 80))
(AddressFamily.AF_INET: 2, 1, 6, '', ('74.125.239.116', 80))
(AddressFamily.AF_INET: 2, 2, 17, '', ('74.125.239.116', 80))
(AddressFamily.AF_INET: 2, 1, 6, '', ('74.125.239.113', 80))
(AddressFamily.AF_INET: 2, 2, 17, '', ('74.125.239.113', 80))
(AddressFamily.AF_INET: 2, 1, 6, '', ('74.125.239.115', 80))
(AddressFamily.AF_INET: 2, 2, 17, '', ('74.125.239.115', 80))
(AddressFamily.AF_INET: 2, 1, 6, '', ('74.125.239.114', 80))
(AddressFamily.AF_INET: 2, 2, 17, '', ('74.125.239.114', 80))
(AddressFamily.AF_INET6: 10, 1, 6, '', ('2607:f8b0:4005:800::1011', 80, 0, 0))
(AddressFamily.AF_INET6: 10, 2, 17, '', ('2607:f8b0:4005:800::1011', 80, 0, 
0))

--

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



[issue18754] Run Python child processes in isolated mode in the test suite?

2013-08-16 Thread STINNER Victor

New submission from STINNER Victor:

Python 3.4 has a new command line option to run Python in isolated mode: -I.

IMO it would be nice to use this option to make the test suite more independant 
of the user configuration and the environment.

Attached patch modifies the test.script_helper module to use the new -I option.

Some tests rely on the current directory added to sys.path, so I had to add a 
python_isolated=False option to script_helper for these tests.

--
components: Tests
files: test_isolated.patch
keywords: patch
messages: 195331
nosy: christian.heimes, haypo
priority: normal
severity: normal
status: open
title: Run Python child processes in isolated mode in the test suite?
versions: Python 3.4
Added file: http://bugs.python.org/file31314/test_isolated.patch

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



[issue18296] test_os.test_trailers() is failing on AMD64 FreeBSD 9.0 dtrace 3.x

2013-08-16 Thread STINNER Victor

STINNER Victor added the comment:

The test does now pass with the patch, so I close the issue.

--
resolution:  - fixed
status: open - closed

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



[issue16799] start using argparse.Namespace in regrtest

2013-08-16 Thread Eli Bendersky

Eli Bendersky added the comment:

Looks pretty good, Serhiy. I left some comments in Rietveld.

--

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



[issue18755] imp read functions do not try to re-open files that have been closed from previous reads

2013-08-16 Thread Brett Cannon

New submission from Brett Cannon:

imp._HackedGetData doesn't check if the file it cached from its constructor is 
still open or not. Since the path had previously been stored it would make 
sense to try re-opening the file if the file object has already been closed.

--
assignee: brett.cannon
components: Library (Lib)
messages: 195334
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: imp read functions do not try to re-open files that have been closed 
from previous reads
type: behavior
versions: Python 3.3, Python 3.4

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



[issue18745] Test enum in test_json is ignorant of infinity value

2013-08-16 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
assignee:  - ethan.furman

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



[issue18734] Berkeley DB versions 4.4-4.9 are not discovered by setup.py

2013-08-16 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

I confirm this. The patch for 5.3 support created a regression. And, in fact, 
it is not working at all (it missed the 5.x libraries anyway).

Reopening the old bug.

In the meantime, please check http://www.jcea.es/programacion/pybsddb.htm

--
dependencies: +update the bsddb module do build with db 5.x versions
nosy: +jcea

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



[issue18734] Berkeley DB versions 4.4-4.9 are not discovered by setup.py

2013-08-16 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +doko

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



[issue17477] update the bsddb module do build with db 5.x versions

2013-08-16 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

This patch is incorrect.

It doesn't compile with Berkeley DB 5.x at all, and it doesn't allow to compile 
against 4.4-4.9 (previously supported). So currently it is a bit regression.

Check bug #18734.

--
nosy: +Eddie.Stanley
resolution: fixed - 
stage: committed/rejected - needs patch
status: closed - open

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



[issue17477] update the bsddb module do build with db 5.x versions

2013-08-16 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Note also that reusing my pybsddb project you are dropping support for several 
old releases of Berkeley DB that where supported by Python 2.7.4.

If somebody were using it, they are left dead in the water, just because doing 
a minor Python upgrade.

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Christian Heimes

New submission from Christian Heimes:

I have seen complains from e.g. Tarek that os.urandom() fails under high load: 
https://twitter.com/tarek_ziade/status/362281268215418880

The problem is caused by file descriptor limits. os.urandom() opens 
/dev/urandom for every call. How about os.urandom() uses a persistent file 
descriptor? That should eliminate the error. It may alsos speed up os.urandom() 
because a persistent FD gets rid of open() and close() syscalls.

* open /dev/urandom on first call of os.urandom() and store the fd in a static 
var
* invalidate, close fd on read() - EINVAL; open /dev/urandom again
* close fd when interpreter shuts down

--
components: Extension Modules
messages: 195338
nosy: christian.heimes, haypo, hynek, tarek
priority: normal
severity: normal
stage: needs patch
status: open
title: os.urandom() fails under high load
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread STINNER Victor

STINNER Victor added the comment:

 I have seen complains from e.g. Tarek that os.urandom() fails under high 
 load: https://twitter.com/tarek_ziade/status/362281268215418880

dev_urandom_python() should handle ENFILE and ENOENT differently to raise a 
different exception. Or it should always call 
PyErr_SetFromErrno(PyExc_OSError); ?

Can tarek tell us more about its usecases: is he directly calling os.urandom() 
or does he use the random module? How many threads?

 How about os.urandom() uses a persistent file descriptor?

os.urandom() is called at Python startup to generate a secret key for random 
hash. If the file descriptor is never closed, the next file descriptor will be 
4 instead of the expect 3.

Always keeping an internal file descriptor open may have unexpected effects 
like leaking a file descriptor to a child process... (see the PEP 446, not 
implemented yet).

I'm ok to keep a fd open if the user controls the lifetime of the object 
(lifetime of the fd). For example, I expect that rng = SystemRandom() opens 
/dev/urandom when the object is created, and closes it when the object is 
destroyed.

--

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



[issue18743] References to non-existant StringIO module

2013-08-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch. Actually this is a small part of larger problem for which I 
will open several separated issues.

--
keywords: +patch
stage: needs patch - patch review
Added file: http://bugs.python.org/file31315/doc_StringIO_refs.patch

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



[issue18618] Need an atexit.register equivalent that also works in subinterps

2013-08-16 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +christian.heimes

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I don't think that's bug in os.urandom(). If os.urandom() doesn't fail, 
something else will fail soon after.
OTOH, the error is clearly misleading. The NotImplementedError should only be 
raised for certain errnos (such as ENOENT, ENODEV, ENXIO and EACCES), not all 
of them.

--
nosy: +neologix, pitrou

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



[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2013-08-16 Thread Charles-François Natali

Charles-François Natali added the comment:

 Perhaps the only thing we could do would be try to preload libgcc by
 calling one of those APIs at startup?

Yeah, I was thinking about doing this in PyThread_init_thread() but...

 But I'm not sure it's a good idea to
 add such a platform-specific hack (for what is arguably an obscure and rare
 issue).

then thought the exact same thing.

Also, this exact problem can possibly show up anywhere dlopen() is
used (a grep through glibc code shows at least an occurrence in
nsswitch-related code).

--

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



[issue18754] Run Python child processes in isolated mode in the test suite?

2013-08-16 Thread Brett Cannon

Brett Cannon added the comment:

Haven't looked at the patch but the motivation behind it sounds good to me.

--
nosy: +brett.cannon

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



[issue18743] References to non-existant StringIO module

2013-08-16 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Patch is incomplete. I found this error while reading unittest.mock, that you 
are not patching.

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

I agree with Antoine. Exhausting the FDs is not the problem, the problem is the 
misleading error.

--
nosy: +jcea

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4238)

2013-08-16 Thread Christian Heimes

Christian Heimes added the comment:

For the record PHP has assigned CVE-2013-4248 for the issue.

--

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



[issue18643] implement socketpair() on Windows

2013-08-16 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Do you mean you want to use a pure python implementation on Unix?

Then you would have to deal with AF_UNIX (which is the default family for 
socketpair() currently).  A pure python implementation which deals with AF_UNIX 
would have to temporarily create a listening socket on the file system and deal 
with races like tempfile.mkstemp() does.  I think it is simpler to only use the 
pure python implementation on Windows.

BTW, it is possible for another process to connect to the address we temporily 
bind to.  Neither my version nor the one in tulip handle that correctly.

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Tarek Ziadé

Tarek Ziadé added the comment:

 If os.urandom() doesn't fail, something else will fail soon after.

the random pool can be exhausted, but this is not soon after I think. In 
Linux and Mac OS X, ulimit -n defaults to 512 and 256.

It's very easy to reach that limit if you write a web app that uses this API.

 I agree with Antoine. Exhausting the FDs is not the problem,

Do you suggest that we should not use os.urandom on high load ?

Opening an FD on every call sounds under optimal, I am not seeing any drawback 
not to try to optimize that API.

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Tarek Ziadé

Tarek Ziadé added the comment:

 Can tarek tell us more about its usecases: is he directly calling 
 os.urandom() or does he use the random module? How many threads?

I was using ws4py inside greenlets. ws4py uses os.urandom() to generate some 
keys. So one single thread, many greenlets.

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Charles-François Natali

Charles-François Natali added the comment:

 If os.urandom() doesn't fail, something else will fail soon after.

 the random pool can be exhausted, but this is not soon after I think. In
 Linux and Mac OS X, ulimit -n defaults to 512 and 256.

I don't think he's referring to the entropy pool, but to RLIMIT_NOFILE.
You'll likely hit EMFILE sooner or later, e.g. on socket(), open()...

 It's very easy to reach that limit if you write a web app that uses this
 API.

 I agree with Antoine. Exhausting the FDs is not the problem,

 Do you suggest that we should not use os.urandom on high load ?

What does high load mean?
If you mean many concurrent threads, then you should probably go for
the random module, no?

 Opening an FD on every call sounds under optimal, I am not seeing any
 drawback not to try to optimize that API.

Well, first we'll have to make the code thread-safe, if we want to
keep a persistent FD open. Which means we'll have to add a lock, which
is likely to reduce concurrency, and overall throughput.

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Christian Heimes

Christian Heimes added the comment:

 Tarek Ziadé added the comment:
 
 If os.urandom() doesn't fail, something else will fail soon after.
 
 the random pool can be exhausted, but this is not soon after I think. In 
 Linux and Mac OS X, ulimit -n defaults to 512 and 256.

It's highly unlikely that you are every going to exhaust the CPRNG to a
point were it is no longer cryptographically secure. Thomas Ptacek
pointed me to http://security.stackexchange.com/a/3939 yesterday.

 I agree with Antoine. Exhausting the FDs is not the problem,
 
 Do you suggest that we should not use os.urandom on high load ?
 
 Opening an FD on every call sounds under optimal, I am not seeing any 
 drawback not to try to optimize that API.

The drawback is a slightly more complicated implementation that has to
deal with invalid FDs.

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Tarek Ziadé

Tarek Ziadé added the comment:

 What does high load mean?

a web app with a few hundreds concurrent requests.

 If you mean many concurrent threads, then you should probably go for
the random module, no?

I use greenlets. But, I don't know - are you suggesting os.urandom() should be 
marked in the documentation as DOES NOT SCALE and I should use another API ? 
Which one ?

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Charles-François Natali

Charles-François Natali added the comment:

2013/8/16, Tarek Ziadé rep...@bugs.python.org:
 I use greenlets. But, I don't know - are you suggesting os.urandom() should
 be marked in the documentation as DOES NOT SCALE and I should use another
 API ? Which one ?

Well, even with greenlets, I assume you're using at least one FD
(socket) per client, no?
So you can get EMFILE on socket() just as on os.urandom(). The only
difference is that sockets are long-lived, whereas os.urandom() only
opens a FD for a couple ms. So os.urandom() isn't your biggest problem
here.
I'd suggest you to just open '/dev/urandom' once, and then make all
your threads/green-threads read from it.
IMO os.urandom() is a really poor API ;-)

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Tarek Ziadé

Tarek Ziadé added the comment:

 Well, even with greenlets, I assume you're using at least one FD
(socket) per client, no?
 So you can get EMFILE on socket() just as on os.urandom(). 

I do many calls on urandom() so that's the FD bottleneck.

 So os.urandom() isn't your biggest problem here.

Of course it is. But it looks like you know better without having looked at the 
code. :)

 I'd suggest you to just open '/dev/urandom' once, 
 and then make all your threads/green-threads read from it.

Let me know how to do this without being able to prevent the API to close the 
FD everytime.

 IMO os.urandom() is a really poor API ;-)

Then we should improve it or deprecate it.

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Christian Heimes

Christian Heimes added the comment:

Am 16.08.2013 18:24, schrieb Charles-François Natali:
 Well, first we'll have to make the code thread-safe, if we want to
 keep a persistent FD open. Which means we'll have to add a lock, which
 is likely to reduce concurrency, and overall throughput.

Why locking? /dev/urandom is a pseudo char device. You can have multiple
readers on the same fd without any locking. Did you know that Java keeps
one persistent fd to /dev/urandom?

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

  Well, even with greenlets, I assume you're using at least one FD
 (socket) per client, no?
  So you can get EMFILE on socket() just as on os.urandom(). 
 
 I do many calls on urandom() so that's the FD bottleneck.

Unless you're doing many calls *in parallel* it's unlikely to be a
bottleneck.
At worse you can write your own /dev/urandom reading code, with a shared
fd amongst all your threads / greenlets.

os.urandom() is a convenience function, it doesn't have to be extremely
optimized.

--

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



[issue1666318] shutil.copytree doesn't give control over directory permissions

2013-08-16 Thread Catherine Devlin

Catherine Devlin added the comment:

Attaching new patch incorporating Vajrasky's suggestion

--
Added file: http://bugs.python.org/file31316/test1666318.patch

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



[issue18706] test failure in test_codeccallbacks

2013-08-16 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


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

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Charles-François Natali

Charles-François Natali added the comment:

 I do many calls on urandom() so that's the FD bottleneck.

 So os.urandom() isn't your biggest problem here.

 Of course it is. But it looks like you know better without having looked at
 the code. :)

So please explain me :-)
os.urandom() can only be called by one thread/greenlet at a time.
So I assumed you're using a per-client thread/greenlet, and so a
per-client socket. So, you have O(N) open sockets, which are
long-lived. OTOH, you can only have so many threads inside
os.urandom() at a time, since it's short lived, and the FD is closed
as soon as urandom() returns. So I would assume that you have
asymptotically at least as many open sockets than FDs open to
os.urandom.

 I'd suggest you to just open '/dev/urandom' once,
 and then make all your threads/green-threads read from it.

 Let me know how to do this without being able to prevent the API to close
 the FD everytime.

Simply open('/dev/urandom', 'rb').

 IMO os.urandom() is a really poor API ;-)

 Then we should improve it or deprecate it.

I don't think it can be fixed. I think Christian's working on a PEP
for random number generators, which would probably make it easier,
although I din't have a look at it.

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Am 16.08.2013 18:24, schrieb Charles-François Natali:
  Well, first we'll have to make the code thread-safe, if we want to
  keep a persistent FD open. Which means we'll have to add a lock, which
  is likely to reduce concurrency, and overall throughput.
 
 Why locking? /dev/urandom is a pseudo char device. You can have multiple
 readers on the same fd without any locking.

You must put a lock around the open() call, though, to avoid calling it
several times and losing an fd.

--

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



[issue18753] [c]ElementTree.fromstring fails to parse value]]/value

2013-08-16 Thread Kees Bos

Kees Bos added the comment:

I'm not an expert, but from: http://www.w3.org/TR/REC-xml/#NT-AttValue

AttValue ::= '' ([^] | Reference)* '' | ' ([^'] | Reference)* 
'

which I read as: Any Reference character is valid, except  and , which are 
used for escaping and closing the element.

The sequence value]]/value also valdates as well-formed at 
http://www.xmlvalidation.com/

The sequence value]/value parses OK (So, it's only with a double ] and  )

It's probably related to parsing ![CDATA[ ... ]] (i.e. I guess when the 
parser detects ]] it 
assumes / requires the state of ![CDATA[ which is, of course, not true)

The sequence value![CDATA[foo]]/value is parsed correctly:
 ET.fromstring('value![CDATA[foo]]/value').text
'foo'


BTW, lxml.etree.fromstring fails also and so does 
http://www.w3schools.com/xml/xml_validator.asp

I'll ask around on the lxml mailinglist what they think about this behavior.

--

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



[issue18753] [c]ElementTree.fromstring fails to parse value]]/value

2013-08-16 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +eli.bendersky, scoder

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Christian Heimes

Christian Heimes added the comment:

Am 16.08.2013 18:47, schrieb Charles-François Natali:
 I don't think it can be fixed. I think Christian's working on a PEP
 for random number generators, which would probably make it easier,
 although I din't have a look at it.

In the light of the recent Android issue with PRNGs [1] I don't think
that Python should roll out its own CPRNG. I'd rather use the operation
system's CPRNG or OpenSSL's CPRNG. After all we aren't crypto experts.
I'd rather point my finger to OpenSSL than take the blame for a faulty
CPRNG.

[1] http://bitcoin.org/en/alert/2013-08-11-android

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Tarek Ziadé

Tarek Ziadé added the comment:

 Unless you're doing many calls *in parallel* it's unlikely to be a
bottleneck.

That's what we're saying since message 1. Antoine, allo quoi! :)

 os.urandom() is a convenience function, it doesn't have to be extremely
optimized

I suggest that you tell it the documentation then, and explain that it does not 
scale and people should write their own thing.

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Charles-François Natali

Charles-François Natali added the comment:

 Why locking? /dev/urandom is a pseudo char device. You can have multiple
 readers on the same fd without any locking.

 You must put a lock around the open() call, though, to avoid calling it
 several times and losing an fd.

Exactly (unless the FD is open during the module initialization,
instead of using lazy-open upon first os.urandom() call).

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Charles-François Natali

Charles-François Natali added the comment:

 In the light of the recent Android issue with PRNGs [1] I don't think
 that Python should roll out its own CPRNG. I'd rather use the operation
 system's CPRNG or OpenSSL's CPRNG. After all we aren't crypto experts.
 I'd rather point my finger to OpenSSL than take the blame for a faulty
 CPRNG.

Yeah, sure.
But it would be nice to have an API similar to the random module (i.e.
a Random ABC, which could have several implementations, among which an
/dev/urandom backed one). The underlying FD lifetime would be tied to
the Random object lifetime, and we couldn't have to open/close it at
each call.

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Attaching a patch to make error reporting better.

--
keywords: +patch
Added file: http://bugs.python.org/file31317/urandom_error.patch

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Tarek Ziadé

Tarek Ziadé added the comment:

 So please explain me :-).

it sounded like you did not really want any explanation 

  os.urandom() can only be called by one thread/greenlet at a time.

do you mean that we cannot have two parallel calls of that function ?
e.g. two opened FD at the same time ?

 So I would assume that you have asymptotically at least as many open sockets 
 than FDs open to os.urandom.

a web socket application that spawns one socket per connection, then uses a lib 
that calls many times os.urandom(), will generate most of its FDs on os urandom

but since you said that os.urandom() should not be used in the first place - 
that's what I will keep in mind

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Donald Stufft

Donald Stufft added the comment:

Just to be explicit, ``open(/dev/urandom)`` only works on POSIX platforms 
while ``os.usrandom`` should work on any supported platform that has an OS 
level source of randomness. So advocating *for* simply using ``open()`` is 
probably a bad idea unless the target OS is only POSIX.

--
nosy: +dstufft

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Good point, Donald. os.urandom() is the only (simple) way to access the Windows 
randomness pool.

--

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



[issue16190] Misleading warning in random module docs

2013-08-16 Thread Donald Stufft

Changes by Donald Stufft donald.stu...@gmail.com:


--
nosy: +dstufft

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



[issue16190] Misleading warning in random module docs

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Done.

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
versions:  -Python 3.2

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Alex Gaynor

Changes by Alex Gaynor alex.gay...@gmail.com:


--
nosy: +alex

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



[issue16190] Misleading warning in random module docs

2013-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9df0501fab35 by Antoine Pitrou in branch '3.3':
Issue #16190: fix random module recommendation to use ssl.RAND_bytes().
http://hg.python.org/cpython/rev/9df0501fab35

New changeset 04b50a1eb013 by Antoine Pitrou in branch 'default':
Issue #16190: fix random module recommendation to use ssl.RAND_bytes().
http://hg.python.org/cpython/rev/04b50a1eb013

New changeset 48b618a9ad10 by Antoine Pitrou in branch '2.7':
Issue #16190: fix random module recommendation to use ssl.RAND_bytes().
http://hg.python.org/cpython/rev/48b618a9ad10

--
nosy: +python-dev

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Charles-François Natali

Charles-François Natali added the comment:

 Attaching a patch to make error reporting better.

Why didn't you include ENODEV?
Apparently it can be reported in some corner cases, e.g. in this patch:
http://lfs-matrix.net/patches/downloads/linux/linux-2.6.14.2-pseudo_random-1.patch

Otherwise, wouldn't self.addCleanup be simpler than the large
try/finally block in the test (but it's not available on 2.7)?

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Why didn't you include ENODEV?
 Apparently it can be reported in some corner cases, e.g. in this patch:
 http://lfs-matrix.net/patches/downloads/linux/linux-2.6.14.2-pseudo_random-1.patch

That isn't mentioned in the POSIX open() spec:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html

However ENODEV still seems to be a standard errno constant, so why not:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html

 Otherwise, wouldn't self.addCleanup be simpler than the large
 try/finally block in the test (but it's not available on 2.7)?

The problem is if some code tries to create a fd before the cleanup
callback is called. With a try/finally block we're guaranteed not to
have such a problem.

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Donald Stufft

Donald Stufft added the comment:

Looking at random.SystemRandom it appears it would suffer from the same FD 
exhaustion problem.

So as of right now afaik none of the sources of cryptographically secure random 
in the python stdlib offer a way to open a persistent FD. The primary question 
on my mind is if os.urandom can't be modified to maintain a persistent FD can 
Python offer a urandom class that *will* maintain a persistent FD?

--

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



[issue1666318] shutil.copytree doesn't give control over directory permissions

2013-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c388e93879c4 by Antoine Pitrou in branch '3.3':
Issue #1666318: Add a test that shutil.copytree() retains directory permissions.
http://hg.python.org/cpython/rev/c388e93879c4

New changeset 8906713d5704 by Antoine Pitrou in branch 'default':
Issue #1666318: Add a test that shutil.copytree() retains directory permissions.
http://hg.python.org/cpython/rev/8906713d5704

--
nosy: +python-dev

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



[issue1666318] shutil.copytree doesn't give control over directory permissions

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Patch committed to 3.3 and 3.4. Thank you very much!

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
versions: +Python 3.3

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 So as of right now afaik none of the sources of cryptographically
 secure random in the python stdlib offer a way to open a persistent
 FD. The primary question on my mind is if os.urandom can't be modified
 to maintain a persistent FD can Python offer a urandom class that
 *will* maintain a persistent FD?

Well, if we want to offer such a facility, let's bundle it in
os.urandom(). It would be suboptimal to have two slightly different
implementations of the same thing.

--

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



[issue18701] Remove outdated PY_VERSION_HEX checks

2013-08-16 Thread Ezio Melotti

Ezio Melotti added the comment:

LGTM.

--

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



[issue18757] Fix internal references for concurrent modules

2013-08-16 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Here is a patch which fixes internal references in the documentation of 
concurrent modules: threading, multiprocessing, concurrent.futures, subprocess, 
queue, and select.

--
assignee: docs@python
components: Documentation
messages: 195378
nosy: bquinlan, docs@python, jnoller, pitrou, rhettinger, sbt, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Fix internal references for concurrent modules
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue18652] Add itertools.first_true (return first true item in iterable)

2013-08-16 Thread R. David Murray

R. David Murray added the comment:

For what it is worth, I am currently writing some email tests and it would 
certainly be convenient to have this.  Of course I *can* define it locally in 
the the test file.

--

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



[issue18757] Fix internal references for concurrent modules

2013-08-16 Thread Ezio Melotti

Ezio Melotti added the comment:

Serhiy, seems you forgot to attach a patch.

--
nosy: +ezio.melotti
type:  - enhancement

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Attached patch to make os.urandom's fd persistent.

--
type: behavior - resource usage
Added file: http://bugs.python.org/file31318/persistent_urandom_fd.patch

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Updated error handling patch testing for ENODEV.

--
Added file: http://bugs.python.org/file31319/urandom_error2.patch

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



[issue16463] testConnectTimeout of test_timeout TCPTimeoutTestCasefailures fails intermittently

2013-08-16 Thread Charles-François Natali

Changes by Charles-François Natali cf.nat...@gmail.com:


Added file: http://bugs.python.org/file31320/connect_timeout-2.diff

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



[issue18704] IDLE: PEP8 Style Check Integration

2013-08-16 Thread Ezio Melotti

Ezio Melotti added the comment:

Can't this be developed as an external extension?
I don't see a reason to include it in the stdlib, especially if it requires 
other dependencies (like the pep8 module).

--
nosy: +ezio.melotti
status: open - pending

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



[issue16799] start using argparse.Namespace in regrtest

2013-08-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
stage:  - test needed

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



[issue16799] start using argparse.Namespace in regrtest

2013-08-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for the review Eli. Could you please review issue17974 while I will 
write tests?

As for a duplication I think about using vars():


def main(tests=None, testdir=None, verbose=0, quiet=False, ...):
return _main(**vars())

def _main(tests, testdir, **kwargs):
ns = argparse.Namespace(**kwargs)
...

--

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



[issue16799] start using argparse.Namespace in regrtest

2013-08-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka

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



[issue18743] References to non-existant StringIO module

2013-08-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't see StringIO in Doc/library/unittest.mock.rst.

--

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



[issue18743] References to non-existant StringIO module

2013-08-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ah, I missed it. Here is completed patch.

--
Added file: http://bugs.python.org/file31321/doc_StringIO_refs_2.patch

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



[issue18707] the readme should also talk about how to build doc.

2013-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6bc88d61f302 by Ezio Melotti in branch '2.7':
#18707: point to Doc/README.txt in the README file.  Patch by Madison May.
http://hg.python.org/cpython/rev/6bc88d61f302

New changeset 477a143bfbfd by Ezio Melotti in branch '3.3':
#18707: point to Doc/README.txt in the README file.  Patch by Madison May.
http://hg.python.org/cpython/rev/477a143bfbfd

New changeset 96c51207e7cd by Ezio Melotti in branch 'default':
#18707: merge with 3.3.
http://hg.python.org/cpython/rev/96c51207e7cd

--
nosy: +python-dev

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



[issue18757] Fix internal references for concurrent modules

2013-08-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry. It is here.

--
keywords: +patch
Added file: http://bugs.python.org/file31322/refs.concurrect.diff

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



[issue18707] the readme should also talk about how to build doc.

2013-08-16 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the report and the patch!

--
assignee: docs@python - ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue16190] Misleading warning in random module docs

2013-08-16 Thread STINNER Victor

STINNER Victor added the comment:

Why did you remove reference to ssl.RAND_bytes() on Python 3.3 from the notice?

--

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



[issue16190] Misleading warning in random module docs

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

As far as I understand, os.urandom() is fine for the task. There's no point in 
mentioning ssl.RAND_bytes() just because it exists, IMO.

--

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



[issue18758] Fix internal references in the documentation

2013-08-16 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

This is a meta issue for fixing broken references in the documentation. I will 
open a child issues for some groups of modules and finally provide a patch for 
rest files.

--
assignee: docs@python
components: Documentation
messages: 195392
nosy: docs@python, eric.araujo, ezio.melotti, georg.brandl, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Fix internal references in the documentation
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue18758] Fix internal references in the documentation

2013-08-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
dependencies: +Fix internal references for concurrent modules, References to 
non-existant StringIO module

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Charles-François Natali

Charles-François Natali added the comment:

 Updated error handling patch testing for ENODEV.

LGTM, you can apply to 2.7 and 3.x (I just hope all those errnos are
available on every POSIX platform ;-).

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 193bcc12575d by Antoine Pitrou in branch '3.3':
Issue #18756: Improve error reporting in os.urandom() when the failure is due 
to something else than /dev/urandom not existing.
http://hg.python.org/cpython/rev/193bcc12575d

New changeset fe949918616c by Antoine Pitrou in branch 'default':
Issue #18756: Improve error reporting in os.urandom() when the failure is due 
to something else than /dev/urandom not existing.
http://hg.python.org/cpython/rev/fe949918616c

--
nosy: +python-dev

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ec296a36156b by Antoine Pitrou in branch '2.7':
Issue #18756: Improve error reporting in os.urandom() when the failure is due 
to something else than /dev/urandom not existing.
http://hg.python.org/cpython/rev/ec296a36156b

--

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



[issue18756] os.urandom() fails under high load

2013-08-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, committed. We're left with the persistent fd patch for 3.4.

--
stage: needs patch - patch review
versions:  -Python 2.7, Python 3.3

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



[issue18720] Switch suitable constants in the socket module to IntEnum

2013-08-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Besides some nitpicks which I have left on Rietveld the patch LGTM.

I guess the _family_converter idiom will be popular enough. Perhaps we will add 
some helper just to the Enum class.

--

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



  1   2   >