[issue19776] Provide expanduser() on Path objects

2014-05-13 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Added a new version of the patch with improvements suggested by Berker Peksag. 
Thanks for the review!

--
Added file: http://bugs.python.org/file35237/issue19776.patch

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



[issue21308] PEP 466: backport ssl changes

2014-05-13 Thread Nick Coghlan

Nick Coghlan added the comment:

Christian, Alex, Donald - is there an in-progress patch for this available at 
all?

2.7.7rc1 is bearing down on us quite rapidly. Given the likely magnitude of 
this change, should we consider targeting 2.7.8, and give the OpenStack CI team 
and others a greater chance to check for any issues based on a source checkout 
before we publish it for general consumption?

--

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



[issue21490] Add Py_ABS and Py_STINGIFY macros

2014-05-13 Thread STINNER Victor

New submission from STINNER Victor:

Attached patches replaces duplicated C macros with two new shared macros: 
Py_ABS(x) and Py_STRINGIFY(x).

I didn't touch PC/pyconfig.h because it uses 3 macros to stringify instead of 
just 2 and I don't know why:
---
/* We want COMPILER to expand to a string containing _MSC_VER's *value*.
 * This is horridly tricky, because the stringization operator only works
 * on macro arguments, and doesn't evaluate macros passed *as* arguments.
 * Attempts simpler than the following appear doomed to produce _MSC_VER
 * literally in the string.
 */
#define _Py_PASTE_VERSION(SUFFIX) \
([MSC v. _Py_STRINGIZE(_MSC_VER)   SUFFIX ])
/* e.g., this produces, after compile-time string catenation,
 *  ([MSC v.1200 32 bit (Intel)])
 *
 * _Py_STRINGIZE(_MSC_VER) expands to
 * _Py_STRINGIZE1((_MSC_VER)) expands to
 * _Py_STRINGIZE2(_MSC_VER) but as this call is the result of token-pasting
 *  it's scanned again for macros and so further expands to (under MSVC 6)
 * _Py_STRINGIZE2(1200) which then expands to
 * 1200
 */
#define _Py_STRINGIZE(X) _Py_STRINGIZE1((X))
#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X
#define _Py_STRINGIZE2(X) #X
---

Maybe it's time to drop these old macros (only required for MSVC 6?) and use 
Py_STRINGIFY? I will try with Visual Studio 2010.

--
files: abs_stringify.patch
keywords: patch
messages: 218409
nosy: haypo
priority: normal
severity: normal
status: open
title: Add Py_ABS and Py_STINGIFY macros
versions: Python 3.5
Added file: http://bugs.python.org/file35238/abs_stringify.patch

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



[issue21412] Solaris/Oracle Studio: Fatal Python error: PyThreadState_Get when built --with-pymalloc

2014-05-13 Thread STINNER Victor

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


--
title: core dump in PyThreadState_Get when built --with-pymalloc - 
Solaris/Oracle Studio: Fatal Python error: PyThreadState_Get when built 
--with-pymalloc

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



[issue21412] Solaris/Oracle Studio: Fatal Python error: PyThreadState_Get when built --with-pymalloc

2014-05-13 Thread STINNER Victor

STINNER Victor added the comment:

This is not a SPARC-specific issue; the exact same failure occurs on x86.

Ah ok, good to know. To me, it looks like a compiler issue. Did you try 
Stefan's advices in issue #15963?

You may try to disable compiler optimizations to see if you get the same 
behaviour.

--

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



[issue21455] add default backlog to socket.listen()

2014-05-13 Thread STINNER Victor

STINNER Victor added the comment:

Hum ok, thanks for your explanation Charles-François. socket_listen-1.diff 
looks good to me.

--

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



[issue21385] in debug mode, compile(ast) fails with an assertion error if an AST node has no line number information

2014-05-13 Thread STINNER Victor

STINNER Victor added the comment:

We can maybe modify the compiler to use the line number 1 if the line 
information is missing?

--
nosy: +benjamin.peterson

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



[issue19775] Provide samefile() on Path objects

2014-05-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Sorry, it seems I have let this issue slip. I will update the patch and commit 
it soon!

--

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



[issue21491] race condition in SocketServer.py ForkingMixIn collect_children

2014-05-13 Thread Ids van der Molen

New submission from Ids van der Molen:

collect_children routine in SocketServer.py contains two possible race 
conditions. First one is in while loop while len(self.active_children) = 
self.max_children:. If status of child is collected outside of Socket server 
(for example in signal handler or something), then the variable 
self.active_children will not match actual child processes and the 
os.waitpid(0, 0) within the while loop will raise os.error, errno=10 (ECHILD) 
No Child Processes. self.active_children should be emptied in this case, 
otherwise you'll end up with an endless loop comsuming 100% CPU (as happened to 
us).

The second possible race condition is below in the collect_children routine in 
the for child in self.active_children which contains a statement 
self.active_children.remove(pid) which would modify the iterator. I do not now 
about python 2.7, but before this would result in incorrect iteration.
Original code:
for child in self.active_children:
try:
pid, status = os.waitpid(child, os.WNOHANG)
except os.error:
pid = None
if not pid: continue
try:
self.active_children.remove(pid)
except ValueError, e:
raise ValueError('%s. x=%d and list=%r' % (e.message, pid, 
self.active_children))

Fixed code:
to_remove = []
for child in self.active_children:
try:
pid, status = os.waitpid(child, os.WNOHANG)
except os.error:
pid = None
if not pid: continue
to_remove.append(pid)

for pid in to_remove:
try:
self.active_children.remove(pid)
except ValueError, e:
raise ValueError('%s. x=%d and list=%r' % (e.message, pid, 
self.active_children))

--
components: Library (Lib)
messages: 218414
nosy: idsvandermolen
priority: normal
severity: normal
status: open
title: race condition in SocketServer.py ForkingMixIn collect_children
type: resource usage
versions: Python 2.7

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



[issue19775] Provide samefile() on Path objects

2014-05-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 197ac5d79456 by Antoine Pitrou in branch 'default':
Issue #19775: Add a samefile() method to pathlib Path objects.
http://hg.python.org/cpython/rev/197ac5d79456

--
nosy: +python-dev

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



[issue21490] Add Py_ABS and Py_STRINGIFY macros

2014-05-13 Thread Serhiy Storchaka

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


--
title: Add Py_ABS and Py_STINGIFY macros - Add Py_ABS and Py_STRINGIFY macros

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



[issue21088] curses addch() argument position reverses in Python3.4.0

2014-05-13 Thread Larry Hastings

Changes by Larry Hastings la...@hastings.org:


--
status: open - closed

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



[issue19775] Provide samefile() on Path objects

2014-05-13 Thread Antoine Pitrou

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


--
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue21491] race condition in SocketServer.py ForkingMixIn collect_children

2014-05-13 Thread Antoine Pitrou

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


--
nosy: +neologix

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



[issue21470] Better seeding for the random module

2014-05-13 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

neologix:

According to man rand(3ssl), OpenSSL uses an internal state of 1023 bytes for 
the RNG.

You only see it reading 32 bytes from /dev/urandom in the strace because it has 
already loaded 1024 bytes from the RNG state file ~/.rng before adding another 
32 bytes:

open(/home/lemburg/.rnd, O_RDONLY)= 3
read(3, .., 4096) = 1024
read(3, , 4096)   = 0
Generating RSA private key, 512 bit long modulus
open(/dev/urandom, O_RDONLY|O_NOCTTY|O_NONBLOCK) = 3
read(3, ..., 32) = 32

FWIW: I'm with Raymond and Tim on this one. I prefer to have a good seed in an 
RNG per default, simply because most application don't bother to reseed RNGs 
every now and then, so having a good start into the day is important :-)

--
nosy: +lemburg

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



[issue21483] Skip os.utime() test on NFS?

2014-05-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Or we could simply catch the EINVAL failure and then skip the test.
I suppose the filesystem doesn't support timestamps  2**32 ?

--
nosy: +pitrou

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



[issue21483] Skip os.utime() test on NFS?

2014-05-13 Thread Antoine Pitrou

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


--
nosy: +larry

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



[issue21470] Better seeding for the random module

2014-05-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Is ~/.rnd any kind of serious? It hasn't been modified since two weeks on my 
system (which is rebooted every day).

--

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



[issue21492] email.header.decode_header sometimes returns bytes, sometimes str

2014-05-13 Thread Jim Minter

New submission from Jim Minter:

Python 3.3.2 (default, Mar  5 2014, 08:21:05) 
[GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux
Type help, copyright, credits or license for more information.
 import email.header
 email.header.decode_header(foo)
[('foo', None)]
 email.header.decode_header(foo=?windows-1252?Q?bar?=)
[(b'foo', None), (b'bar', 'windows-1252')]

I may well be wrong, but I believe it's erroneous that in the second example 
above, b'foo' is returned instead of the expected 'foo'.

--
components: Library (Lib)
messages: 218419
nosy: jim_minter
priority: normal
severity: normal
status: open
title: email.header.decode_header sometimes returns bytes, sometimes str
type: behavior
versions: Python 3.3

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



[issue21483] Skip os.utime() test on NFS?

2014-05-13 Thread Larry Hastings

Larry Hastings added the comment:

Antoine's plan sounds good to me.  And, is it true that NFS only supports 
four-byte timestamps?

--

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



[issue21401] python2 -3 does not warn about str/unicode to bytes conversions and comparisons

2014-05-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue19656.

--
nosy: +serhiy.storchaka

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



[issue17756] test_syntax_error fails when run in the installed location

2014-05-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 20db5e9086d4 by doko in branch '3.4':
- Issue #17756: Fix test_code test when run from the installed location.
http://hg.python.org/cpython/rev/20db5e9086d4

New changeset 8885fc2e92b3 by doko in branch 'default':
Merge from 3.4:
http://hg.python.org/cpython/rev/8885fc2e92b3

--
nosy: +python-dev

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



[issue17756] test_syntax_error fails when run in the installed location

2014-05-13 Thread Matthias Klose

Matthias Klose added the comment:

not yet closing, to see if there are some stream buffering issues in mock

--

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



[issue21470] Better seeding for the random module

2014-05-13 Thread Charles-François Natali

Charles-François Natali added the comment:

 According to man rand(3ssl), OpenSSL uses an internal state of 1023 bytes for 
 the RNG.

 You only see it reading 32 bytes from /dev/urandom in the strace because it 
 has already loaded 1024 bytes from the RNG state file ~/.rng before adding 
 another 32 bytes:

Remove this .rnd file, and you'll see on the next run that it still
only reads 32 bytes.
Same holds for openssh.

I'm not using this as an argument against increasing the seed size -
Tim and Raymond convinced me - I'm just curious.

--

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



[issue21470] Better seeding for the random module

2014-05-13 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 13.05.2014 11:06, Antoine Pitrou wrote:
 
 Is ~/.rnd any kind of serious? It hasn't been modified since two weeks on my 
 system (which is rebooted every day).

The file is apparently only updated if you use one the OpenSSL commands
which needs random data. grep for RAND_write_file in the apps/ subdir
of the OpenSSL distribution. Of course, applications can also use that API,
so there may be other situations where it gets updated as well.

However, when removing that file, OpenSSL still only reads 32 bytes from
/dev/urandom, which suggests that it's either using some other sources
of randomness as well (there are some timing tricks being used in the
code for this), or (more likely) simply doesn't need more random
bytes to start with.

So while the file does have some meaning, it's not why I had thought
it would be.

Here's a more likely explanation:

The OpenSSL random number source only works with hash
function feedback and random data that gets added to it. It's not
an PRNG with provable characteristics.

OpenSSL uses SHA-1 for hashing which has a 20 byte digest size, so an
initial vector of 32 bytes is a good start (though more are always
better ;-)):

http://en.wikipedia.org/wiki/Randomness_extractor

That said and coming back to the question why 32 bytes are enough for
OpenSSL: the OpenSSL RNG is being seeded with a seed from the
full range of possible values (160 bits). It's period is a lot smaller
than the MT one (19937 bits), which is why fewer random bytes are
needed.

--

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



[issue21430] Document ssl.pending()

2014-05-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

For the record, SSLSocket.pending() was added in b59825d9db8f with the commit 
message get SSL support to work again. It isn't used anywhere in the stdlib. 
It isn't used by asyncio, Tornado or Twisted. It isn't necessary to write 
non-blocking SSL applications, and it can actually lead to misunderstandings as 
some messages on this issue show.

I'd rather deprecate the method than start documentating it.

--

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



[issue21493] Add test for ntpath.expanduser

2014-05-13 Thread Claudiu.Popa

New submission from Claudiu.Popa:

Hello. This patch adds a test for ntpath.expanduser, which was missing. Also, 
it increases the test coverage for ntpath.py from 68% to 75%.

--
components: Tests
files: expanduser.patch
keywords: patch
messages: 218427
nosy: Claudiu.Popa
priority: normal
severity: normal
status: open
title: Add test for ntpath.expanduser
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file35239/expanduser.patch

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



[issue20977] pyflakes: undefined ctype in 2 except blocks in the email module

2014-05-13 Thread Rose Ames

Rose Ames added the comment:

This is my first attempt at contributing to python  I'd really appreciate some 
feedback :).  Should I have added a test to demonstrate the bug before trying 
to fix it?

--

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



[issue21484] More clarity needed about difference between x += e and x = x + e

2014-05-13 Thread Feliks

Feliks added the comment:

Well, there is some anecdotal evidence. ;-)  I happen to have a lot of 
experience with a lot of programming languages, and I was bitten by this.

Let's put it like this: it is quite easy to overlook the significance of the 
sentence in question.  One looks at the paragraph, reads the stuff about 
evaluation, thinks of course and moves on.

If the sentence were in a new paragraph, and instead of with Also began with 
something like More importantly, then it might have drawn more attention.

After all, the drastic semantic difference between the two forms is quite 
unlike what one is used to from programming in, say, C.  I think it would be 
helpful if it were stressed a little bit more.

--

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



[issue19656] Add Py3k warning for non-ascii bytes literals

2014-05-13 Thread STINNER Victor

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


--
nosy: +haypo

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



[issue21488] codecs.encode/decode documentation inconsistency

2014-05-13 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
keywords: +patch
nosy: +berker.peksag, ncoghlan
stage:  - patch review
type: resource usage - behavior
versions: +Python 3.4, Python 3.5
Added file: http://bugs.python.org/file35240/issue21488.diff

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



[issue21430] Document ssl.pending()

2014-05-13 Thread Alexey Gorshkov

Alexey Gorshkov added the comment:

Ok. As 
https://docs.python.org/dev/library/ssl.html#notes-on-non-blocking-sockets 
says: Calling select() tells you that the OS-level socket can be read from (or 
written to), and here is situation: len(select([ssl_socket],[],[], 0.2)[0]) 
returns 0, but ssl layer has pending data and SSLWantWriteError or 
SSLWantReadError instead of BlockingIOError are not raised, because there is 
no error.. How should app know what it's need to do another recv() call? Are 
You suggesting to make loop like this (as for non-blocking socket)?

while True:
ssl_socket.recv(4096)
if something:
break


what I think is: pending() method - is fine solution for knowing needed 
information about ssl layer status.

SSL_pending(3) is not deprecated in OpenSSL, and I do not see reason why it 
should be deprecated in python. I do not think it should be deprecated only 
because it is not used. And it is not need to tell about asyncio, Tornado or 
Twisted.

--

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



[issue21483] Skip os.utime() test on NFS?

2014-05-13 Thread Skip Montanaro

Skip Montanaro added the comment:

 Or we could simply catch the EINVAL failure and then skip the test.
 I suppose the filesystem doesn't support timestamps  2**32 ?

Just in that one test? If I passed -1 that would probably also
generate EINVAL (haven't tested).

I'll have to check with the admins to see if this particular
filesystem is NFS3 or NFS4. I'm guessing 2**32 might be the max for
the former. The latter causes us all sorts of other heartburn though,
so even though it might be more modern in this regard, we don't use
it much.

--

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



[issue21430] Document ssl.pending()

2014-05-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Alexey, to quote your own link, here is the proper way:
http://www.perlmonks.org/?node_id=845640

 And it is not need to tell about asyncio, Tornado or Twisted.

Of course it is :-) It is generally far better to use an existing non-blocking 
I/O framework, than grow your own event loop.

--

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



[issue20565] Update Tcl/Tk version for buildbots

2014-05-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Zachary.

--

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



[issue20560] tkFileFilter.c: ostypeCount not initialized?

2014-05-13 Thread Serhiy Storchaka

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


--
status: open - pending

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



[issue4913] wave.py: add writesamples() and readsamples()

2014-05-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I hope all mentioned bugs were already fixed in the wave module.

As for new writesamples() and readsamples() methods, perhaps it would be better 
to add utility functions in the audioop module for packing/unpacking integers. 
In any case a user can use array.array.

--

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



[issue19385] dbm.dumb should be consistent when the database is closed

2014-05-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Claudiu, your benchmark is broken, it measure a no-op.

Correct benchmark:

$ ./python -S -m timeit -n 10 -s import dbm.dumb as dbm; 
d=dbm.open('x.dat', 'c')  len(d)

3.4:  10 loops, best of 3: 2.56 usec per loop
3.5:  10 loops, best of 3: 4.17 usec per loop

There is 60% regression.

--
status: closed - open

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



[issue18615] sndhdr.whathdr could return a namedtuple

2014-05-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Personally I doubt it is a good idea to convert any tuple to named tuple. There 
are downsides: this increases memory usage and decreases performance; this 
changes pickled data and makes it backward incompatible (and even worse with 
other serialization methods).

--

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



[issue21308] PEP 466: backport ssl changes

2014-05-13 Thread Alex Gaynor

Alex Gaynor added the comment:

I have not started on this patch yet, I'd wanted to get the other, smaller, 
backports done first. Unless someone else is planning on getting to this, I 
think 2.7.8 is more realistic.

--

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



[issue21308] PEP 466: backport ssl changes

2014-05-13 Thread Donald Stufft

Donald Stufft added the comment:

I agree that 2.7.8 is more realistic. This particular backport is going to be 
the most work due to the scope of it.

--

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



[issue18615] sndhdr.whathdr could return a namedtuple

2014-05-13 Thread Claudiu.Popa

Claudiu.Popa added the comment:

But it improves the API. It's much nicer to actually access the values returned 
by sndhdr as f.type, f.sampling_rate, f.channels than f[0], f[1], f[2]. You do 
have a point though. Would it be more acceptable if we'll provide a new 
function which returns a namedtuple and leaving `whathdr` and `what` in peace?

--

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



[issue19385] dbm.dumb should be consistent when the database is closed

2014-05-13 Thread Jim Jewett

Jim Jewett added the comment:

Did you try 3.5 without the patch, in case the issue is not with his code?
On May 13, 2014 7:23 AM, Serhiy Storchaka rep...@bugs.python.org wrote:


 Serhiy Storchaka added the comment:

 Claudiu, your benchmark is broken, it measure a no-op.

 Correct benchmark:

 $ ./python -S -m timeit -n 10 -s import dbm.dumb as dbm;
 d=dbm.open('x.dat', 'c')  len(d)

 3.4:  10 loops, best of 3: 2.56 usec per loop
 3.5:  10 loops, best of 3: 4.17 usec per loop

 There is 60% regression.

 --
 status: closed - open

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


--

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



[issue21492] email.header.decode_header sometimes returns bytes, sometimes str

2014-05-13 Thread Berker Peksag

Berker Peksag added the comment:

  email.header.decode_header(foo)
 [('foo', None)]

email.header.decode_header() implements rfc-2047 and the foo header doesn't 
match the syntax described in rfc-2047 (see 2. Syntax of encoded-words).

See the code for more information:

* http://hg.python.org/cpython/file/default/Lib/email/header.py#l34
* http://hg.python.org/cpython/file/default/Lib/email/header.py#l81

See the 6.1. Recognition of 'encoded-word's in message headers section at 
http://www.rfc-base.org/txt/rfc-2047.txt

--
components: +email
nosy: +barry, berker.peksag, r.david.murray

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



[issue19385] dbm.dumb should be consistent when the database is closed

2014-05-13 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Right, my benchmark was indeed flawed. Here are the new results on my machine:

Without the patch
# ./python -S -m timeit -n 10 -s import dbm.dumb as dbm; 
d=dbm.open('x.dat', 'c')  len(d)
10 loops, best of 3: 0.564 usec per loop

With the patch
# ./python -S -m timeit -n 10 -s import dbm.dumb as dbm; 
d=dbm.open('x.dat', 'c')  len(d)
10 loops, best of 3: 0.857 usec per loop

Even having an empty _verify_open in __len__ method leads to this:

# ./python -S -m timeit -n 10 -s import dbm.dumb as dbm; 
d=dbm.open('x.dat', 'c')  len(d)
10 loops, best of 3: 0.749 usec per loop

--

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



[issue20544] Use specific asserts in operator tests

2014-05-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I had stopped committing patches for similar issues because there is an 
opposition against this. See discussion at 
http://comments.gmane.org/gmane.comp.python.devel/145535.

--

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



[issue19385] dbm.dumb should be consistent when the database is closed

2014-05-13 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Here's a new patch which uses the EAFP approach for dunder methods (__len__, 
__contains__ etc) and the _verify_open method for the other methods (.keys, 
.iterkeys) etc. Now the results are similar with the benchmark without the 
patch.

--
Added file: http://bugs.python.org/file35241/issue19385_speed.patch

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



[issue20544] Use specific asserts in operator tests

2014-05-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think these transformations are useful, because on failure they will give you 
what is the actual value of the compared operands (something which assertTrue 
is enable to extract).

Also they are clearer to read IMO.

--
nosy: +pitrou

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



[issue20544] Use specific asserts in operator tests

2014-05-13 Thread STINNER Victor

STINNER Victor added the comment:

I agree with Antoine.

--
nosy: +haypo

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



[issue21494] getopt error doesnot display correct error

2014-05-13 Thread Priya pawar

New submission from Priya pawar:

i created command from getopt but it gives error if i give single hyphan in 
long option
it should check long option not in small option. 

eg.  hello -foo
 -o option is not recognized

hello --foo is working fine.

--
messages: 218447
nosy: priya
priority: normal
severity: normal
status: open
title: getopt error doesnot display correct error
type: enhancement
versions: Python 2.7

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



[issue20977] pyflakes: undefined ctype in 2 except blocks in the email module

2014-05-13 Thread R. David Murray

R. David Murray added the comment:

It doesn't really matter what order you do it in (though I prefer to write 
tests first, usually), but yes, we will want tests before we commit the fix.

I tried to be thorough in my testing, but obviously I missed some branches :(.

--

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



[issue21494] getopt error doesnot display correct error

2014-05-13 Thread Eric V. Smith

Eric V. Smith added the comment:

That's working as designed. It allows you to say -fo if both 'f' and 'o' are 
short options.

--
nosy: +eric.smith

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



[issue21492] email.header.decode_header sometimes returns bytes, sometimes str

2014-05-13 Thread R. David Murray

R. David Murray added the comment:

The error is actually the first case returning string rather than bytes.  See 
issue 6302.

--
dependencies: +Add decode_header_as_string method to email.utils
resolution:  - duplicate
stage:  - resolved
status: open - closed

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



[issue21492] email.header.decode_header sometimes returns bytes, sometimes str

2014-05-13 Thread R. David Murray

R. David Murray added the comment:

Hmm.  It looks like we decided that we couldn't fix the behavior for backward 
compatibility reasons.  In 3.4 you can use the new email policies to get 
automatic, correct stringification of headers.

--

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



[issue20977] pyflakes: undefined ctype in 2 except blocks in the email module

2014-05-13 Thread STINNER Victor

STINNER Victor added the comment:

I would prefer to see the patch applied if no test can be written.

The bug was not notified before.

--

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



[issue21495] Sane default for logging config

2014-05-13 Thread Thomas Guettler

New submission from Thomas Guettler:

Imagine you write a small console script which is implemented like a library.

This tool has to do two things: the console script needs to configure the 
logging, and the library needs to use it.

The library usage of logging it easy well documented:

{{{
logger=logging.getLogger(__name__)
}}}

But the part in the console script has no sane default in the python world. 

I know how to set up the logging config with BasicConfig, DictConfig, ...

There needs to be something like DefaultConfig() which reads its config from 
well known places. 

This bug report is not about clever code solutions. It is about a sane and easy 
default agreement on how to load the logging configuration.

--
messages: 218453
nosy: guettli
priority: normal
severity: normal
status: open
title: Sane default for logging config

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



[issue21304] PEP 466: Backport hashlib.pbkdf2_hmac to Python 2.7

2014-05-13 Thread Alex Gaynor

Alex Gaynor added the comment:

New patch includes the documentation as well.

--
keywords: +needs review
Added file: http://bugs.python.org/file35242/pbkdf2.diff

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



[issue21496] pyvenv activate_this.py

2014-05-13 Thread couplewavylines

New submission from couplewavylines:

Is there any plan to add an 'activate_this.py' to venv? The virtualenv package 
includes this script. Its purpose is to activate the environment in-place, 
from other Python code.
One use-case is running multiple WSGI apps that each need a different virtual 
environment: https://www.pythonanywhere.com/wiki/VirtualEnvForNewerDjango

--
components: Library (Lib)
messages: 218455
nosy: couplewavylines
priority: normal
severity: normal
status: open
title: pyvenv activate_this.py
type: enhancement
versions: Python 3.4, Python 3.5

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



[issue21304] PEP 466: Backport hashlib.pbkdf2_hmac to Python 2.7

2014-05-13 Thread Alex Gaynor

Alex Gaynor added the comment:

I'm still concerned about the unicode issue, but I'm not sure what the right 
way to fix it is.

--

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



[issue21304] PEP 466: Backport hashlib.pbkdf2_hmac to Python 2.7

2014-05-13 Thread Donald Stufft

Donald Stufft added the comment:

The attached patch looks pretty good to me.

--

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



[issue21304] PEP 466: Backport hashlib.pbkdf2_hmac to Python 2.7

2014-05-13 Thread Donald Stufft

Donald Stufft added the comment:

I don't think there's any way around it, nor do I think that it actually leaks 
any meaningful timing.

--

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



[issue21304] PEP 466: Backport hashlib.pbkdf2_hmac to Python 2.7

2014-05-13 Thread Donald Stufft

Donald Stufft added the comment:

Oh, gotcha.

Yea I agree, but it's Python 2.x that's par for the course.

--

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



[issue21304] PEP 466: Backport hashlib.pbkdf2_hmac to Python 2.7

2014-05-13 Thread Alex Gaynor

Alex Gaynor added the comment:

Sorry, I wasn't concerned from a timing attack perspective here, I was 
concerned from an oh my god implicit coercion is terrible perspective :-)

--

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



[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-13 Thread Florian Bruhin

New submission from Florian Bruhin:

When faulthandler is used while sys.stderr is None (e.g. when using 
pythonw.exe), a (IMHO) confusing exception is raised:

Traceback (most recent call last):
  File test.py, line 7, in module
 faulthandler.enable()
AttributeError: 'NoneType' object has no attribute 'fileno'

Example script which demonstrates the issue without using pythonw.exe:

import faulthandler
import sys

sys.stderr = None

try:
faulthandler.enable()
except:
sys.stderr = sys.__stderr__
raise

Looking at the code it seems the file passed gets correctly checked against 
NULL and Py_None, but stderr (as fallback) then only gets checked against NULL:

http://hg.python.org/cpython/file/8885fc2e92b3/Modules/faulthandler.c#l141

--
components: Extension Modules
messages: 218461
nosy: The Compiler, haypo
priority: normal
severity: normal
status: open
title: faulthandler should handle sys.stderr being None gracefully
type: behavior
versions: Python 3.3, Python 3.4

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



[issue21423] concurrent.futures.ThreadPoolExecutor should accept an initializer argument

2014-05-13 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

Related:
https://groups.google.com/forum/#!topic/dev-python/ytbYwHXKC6o
I'm not sure how what is proposed here would be useful for ThreadPoolExecutor 
but it would definitely be helpful being able to set an initializer for 
ProcessPoolExecutor because right now it seems it's impossible to cleanly 
shutdown the executor, see:
http://noswap.com/blog/python-multiprocessing-keyboardinterrupt

--
nosy: +giampaolo.rodola

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



[issue21498] configparser accepts keys beginning with comment_chars when writing

2014-05-13 Thread Florian Bruhin

New submission from Florian Bruhin:

When adding something to a configparser instance which has a key beginning with 
a comment char, it writes the data to a file without generating an error, and 
when reading the file back obviously the data is different as it's a comment:

 cp = configparser.ConfigParser()
 cp.read_dict({'DEFAULT': {';foo': 'bar'}})
 cp.write(sys.stdout)
[DEFAULT]
;foo = bar

This was discussed on python-dev here:
https://mail.python.org/pipermail/python-dev/2014-April/134293.html

Of course there are other corner cases as well, like having a key like [foo] 
or =bar.

I think whatever data I pass into a configparser should also come out again 
when reading the file back.

Since there's no escaping in configparser, I think the ideal solution would be 
configparser refusing to write ambigious values.

While this is technically a backwards-incompatible change, applications doing 
this were broken in the first place, so validation while writing will not break 
anything.

Validating when setting values would be better of course, but this can 
potentially break applications where configparser is used without actually 
writing a file.

--
components: Library (Lib)
messages: 218463
nosy: The Compiler, lukasz.langa
priority: normal
severity: normal
status: open
title: configparser accepts keys beginning with comment_chars when writing
type: behavior

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



[issue21488] codecs.encode/decode documentation inconsistency

2014-05-13 Thread Brett Cannon

Brett Cannon added the comment:

Berker's patch LGTM, so assigning to him to commit.

--
assignee: docs@python - berker.peksag
nosy: +brett.cannon
stage: patch review - commit review

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



[issue21494] getopt error doesnot display correct error

2014-05-13 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
resolution:  - not a bug
stage:  - resolved
status: open - closed
type: enhancement - behavior

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



[issue9253] argparse: optional subparsers

2014-05-13 Thread couplewavylines

Changes by couplewavylines couplewavyli...@gmail.com:


--
nosy: +couplewavylines

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



[issue21489] Switching from -OO to -O still uses cached bytecode

2014-05-13 Thread Brett Cannon

Brett Cannon added the comment:

It's something that could potentially be changed in the future, but no one has 
prioritized it enough to worry about it. Typically this opens a pandora's box 
of wanting to generalize it so it supports custom user optimizations as well 
and then people lose motivation to push it through to the end. =)

--
nosy: +brett.cannon
resolution:  - duplicate
status: open - closed

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



[issue21401] python2 -3 does not warn about str/unicode to bytes conversions and comparisons

2014-05-13 Thread Brett Cannon

Brett Cannon added the comment:

I thought we gave ourselves the wiggle room to change the warnings we emitted 
for -3 (I unfortunately can't find a reference to something relating to that in 
the Python 2.7 PEP)?

--

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



[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-13 Thread STINNER Victor

STINNER Victor added the comment:

Attached patch modifies faulthandler to raises a RuntimeError(sys.stderr is 
None) with your use case. Is it what you expected?

--
keywords: +patch
Added file: http://bugs.python.org/file35243/faulthandler.patch

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



[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-13 Thread Florian Bruhin

Florian Bruhin added the comment:

I didn't test the patch (I don't have the toolchain set up to do so), but it 
looks like this is indeed an exception which makes more sense to the developer.

When I saw the exception as it is now, I only discovered it's related to stderr 
being None by finding people having a similiar issue with curses, and with the 
new exception it'd be clear to me what happened.

I personally would prefer failing silently though so the application still runs 
(if there's no stderr, there just is no fault log), but that's debatable of 
course.

--

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



[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-13 Thread STINNER Victor

STINNER Victor added the comment:

 I personally would prefer failing silently though so the application still 
 runs (if there's no stderr, there just is no fault log), but that's debatable 
 of course.

Nope, there is no debate: there is the Zen of Python :-)

Errors should never pass silently.

What's the purpose of enabling faulthandler if sys.stderr is None? If you don't 
want faulthandler output, don't enable faulthandler!?

--

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



[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-13 Thread Florian Bruhin

Florian Bruhin added the comment:

The thing is the developer is not necessarely the one controlling if sys.stderr 
is None, sometimes the user is.

For example, see 
https://docs.python.org/3.4/using/windows.html#executing-scripts-without-the-python-launcher
 - an user might have decided to use pythonw by default.

This means there's an unexpected gotcha - if I want my application to still run 
under Windows when the user has changed the default, I first have to check 
sys.stderr before enabling faulthandler.

At the very least I think this should be documented in the faulthandler 
documentation. I noticed the issue when starting my application under Windows 
after using cx_Freeze on it, and as a developer wouldn't have expected (or 
thought about this) at all.

I don't feel like I'm the one to decide this properly though, and I'm uncertain 
what's the right choice, so what you say is probably right ;)

--

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



[issue21497] faulthandler should handle sys.stderr being None gracefully

2014-05-13 Thread STINNER Victor

STINNER Victor added the comment:

 This means there's an unexpected gotcha

I prefer to see an exception before sys.stderr is None, instead of not seeing 
the traceback when the application does crash. It is usually a pain to 
reproduce a crash in the exact same conditions.

 if I want my application to still run under Windows when the user has changed 
 the default, I first have to check sys.stderr before enabling faulthandler.

Exactly. It's not really specific to Windows, you may also have sys.stderr on 
UNIX in some cases.

--

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



[issue21422] int 0: return the number unmodified

2014-05-13 Thread Francisco Martín Brugué

Francisco Martín Brugué added the comment:


 What we want to test is that the return value is of type 'int', which is what 
 Victor's test checks.

Thank you for the explanations!

for 2.7.6 type(2  62) is type 'long' and type(2  61) is
type 'int' (I suppose it's analogous in a 32 bit machine
around type(2  30) so I just wanted to test on that limits).

Is that still relevant? or is too much detail and we should stop here.

Regards,
francis

--

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



[issue21329] configparser can't parse MySQL style config

2014-05-13 Thread R. David Murray

R. David Murray added the comment:

The data structure you are asking for bears a resemblance to the data structure 
used by the email package to record message headers.  Email uses a list with a 
dict-like API cobbled together on top.  The difference with your suggestion is 
that email also needs to record the order of the headers, so just having a 
list-of-values for each key isn't adequate.  Any bets on whether or not we 
eventually run across a use of .ini format where the exact order of the 
duplicated keys within the whole list of keys matters? :)

With two use cases that could be served by the same data structure in the 
stdlib, I wonder if it is worth actually building the abstract data type.  
Probably not, but I thought I'd raise the possibility anyway :)

--
nosy: +r.david.murray
type:  - enhancement
versions: +Python 3.5 -Python 3.4

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



[issue19656] Add Py3k warning for non-ascii bytes literals

2014-05-13 Thread Arfrever Frehtes Taifersar Arahesis

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


--
nosy: +Arfrever

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



[issue21499] test_importlib incorrectly relies on module.__builtins__

2014-05-13 Thread Eric Snow

New submission from Eric Snow:

Per the docs*, a module's __builtins__ may be a module or a dict or even 
missing.  However, test.test_importlib.test_api.ReloadTests checks __builtins__ 
as part of several tests.  Instead, the tests should ignore __bulitins__.  I'll 
push a patch in a minute that fixes that.

* https://docs.python.org/3/library/builtins.html

--
assignee: eric.snow
components: Tests
messages: 218474
nosy: brett.cannon, eric.snow
priority: normal
severity: normal
stage: needs patch
status: open
title: test_importlib incorrectly relies on module.__builtins__
type: behavior
versions: Python 3.4, Python 3.5

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



[issue21499] test_importlib incorrectly relies on module.__builtins__

2014-05-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 16d26391ec36 by Eric Snow in branch '3.4':
Issue #21499: Ignore __builtins__ in several test_importlib.test_api tests.
http://hg.python.org/cpython/rev/16d26391ec36

New changeset bdf94b2c0639 by Eric Snow in branch 'default':
Merge from 3.4 (for #21499).
http://hg.python.org/cpython/rev/bdf94b2c0639

--
nosy: +python-dev

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



[issue21499] test_importlib incorrectly relies on module.__builtins__

2014-05-13 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
resolution:  - fixed
stage: needs patch - resolved
status: open - closed

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



[issue21500] Make use of the load_tests protocol in test_importlib packages

2014-05-13 Thread Eric Snow

New submission from Eric Snow:

Right now to run importlib tests you can do either of the following:

./python -m tests test_importlib
./python -m tests.test_importlib

Both make use of the regrtest infrastructure.  For test submodules the commands 
are similar:

./python -m tests test_importlib.test_api
./python -m tests.test_importlib.test_api

You can also use unittest directly when testing specific test modules:

./python -m unittest tests.test_importlib.test_api
./python -m unittest 
tests.test_importlib.test_api.Source_ReloadTests.test_reload_location_changed

However, currently you cannot use unittest directly with a test package:

./python -m unittest tests.test_importlib
./python -m unittest tests.test_importlib.source

It would be nice to be able to do so, rather than switching back and forth 
between the unittest CLI and the regrtest CLI.

The change to do so is relatively straight-forward using the load_tests 
protocol*.  Just add the following to the __init__.py of the test packages:

 def load_tests(loader, tests, pattern):
 from test import TEST_HOME_DIR as topdir
 startdir = os.path.dirname(__name__)
 pkgtests = loader.discover(startdir, pattern or 'test*.py', topdir)
 tests.addTests(pkgtests)
 return tests

The boilerplate could even be moved to tests.support as a factory function:

 def make_load_tests(modfilename):
 from test import TEST_HOME_DIR as topdir
 startdir = os.path.dirname(modfilename)
 def load_tests(loader, tests, pattern):
 pkgtests = loader.discover(startdir, pattern or 'test*.py', topdir)
 tests.addTests(pkgtests)
 return tests
 return load_tests

In the test package __init__.py:

  load_tests = support.make_load_tests(__name__)

Then using unittest directly with an importlib test package will work as 
expected.  This is also something that could readily apply to any other test 
packages in the suite, which is why the factory function in test.support makes 
sense.

* https://docs.python.org/2/library/unittest.html#load-tests-protocol

--
components: Tests
messages: 218476
nosy: brett.cannon, eric.snow
priority: low
severity: normal
stage: needs patch
status: open
title: Make use of the load_tests protocol in test_importlib packages
type: enhancement
versions: Python 3.5

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



[issue21470] Better seeding for the random module

2014-05-13 Thread Tim Peters

Tim Peters added the comment:

Crytpo generators are a whole different world, and I wouldn't listen to anyone 
save a bona fide expert in that field.  Plausible:  the hardest thing OpenSSL 
has to do is generate secure RSA keys.  But the bit length of an RSA key can't 
be taken at face value:  the true strength of such a key is measured by the 
number of operations required to break it.  According to (among many others):

http://en.wikipedia.org/wiki/Key_size#Asymmetric_algorithm_key_lengths

NIST key management guidelines further suggest that 15360-bit RSA keys are 
equivalent in strength to 256-bit symmetric keys.

So 32 bytes = 256 bits of entropy is sufficient to generate secure 15360-bit 
RSA keys, which is larger than virtually anyone actually uses (so far), 
provided everything else is done exactly right.

For that reason, bug reports about OpenSSL using only 32 bytes seem to get 
brushed off, like:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=742145

So what does that have to do with Python's random()?  Nothing ;-)

A more fruitful tack would be to investigate switching away from the Mersenne 
Twister.  It was groundbreaking at the time, but nothing lasts forever.  Even 
Wikipedia can come up with a list of its disadvantages now, including the 
state space is too large and uselessly stresses the CPU cache:

http://en.wikipedia.org/wiki/Mersenne_twister#Disadvantages

Worse (according to me), when it reaches a point where most of the bits in 
its state are zeroes, it can take a long time (many calls) before its outputs 
pass randomness tests again - a paucity of 1 bits tends to persist way too 
long.

More recent algorithms claim to address these flaws, with smaller state and 
similar speed.  But they're marginal improvements, and don't seem to be gaining 
traction quickly.  The Twister was a huge improvement at the time, and caught 
on very quickly.

In the meantime, better safe than sorry.

--

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



[issue21501] submitting mmap example for use in documentation

2014-05-13 Thread Steve Foley

New submission from Steve Foley:

Hello, I would like to submit an example for the mmap docs page. It 
demonstrates the use of shared memory and message passing between processes. 
Thanks!



import mmap, os, select

NUM_CHILDREN = 30
MSG_LEN = 8
BUF_LEN = NUM_CHILDREN * MSG_LEN

buf = mmap.mmap(-1, BUF_LEN)
p = select.poll()

def write_buffer(i):
msg = '%s\t%d\n' % (i, os.getpid())
offset = MSG_LEN * i
buf.seek(offset)
buf.write(msg)

def child(i, pipeout):
write_buffer(i)
os.write(pipeout, 'OK\0'.encode())
os._exit(0)

def fork(i, p):
pipein, pipeout = os.pipe()
if os.fork() == 0:
child(i, pipeout)
else:
p.register(pipein)

def loop(msgs, p):
while msgs:
for fd, event in p.poll():
p.unregister(fd)
msgs = msgs - 1

for i in range(NUM_CHILDREN):
fork(i, p)

loop(NUM_CHILDREN, p)

buf.seek(0)
print buf.read(BUF_LEN)

--
assignee: docs@python
components: Documentation
messages: 218478
nosy: docs@python, hudson
priority: normal
severity: normal
status: open
title: submitting mmap example for use in documentation
type: enhancement
versions: Python 2.7

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



[issue2052] Allow changing difflib._file_template character encoding.

2014-05-13 Thread Berker Peksag

Berker Peksag added the comment:

Attaching two patches:

issue2052.diff adds a charset keyword argument to HtmlDiff.make_file().

issue2052_html5.diff also adds a charset keyword argument to 
HtmlDiff.make_file() and updates the markup of HtmlDiff() to HTML5. I tested it 
with Firefox 29 and Chrome 34.

--
keywords: +patch
nosy: +berker.peksag
stage: needs patch - patch review
versions: +Python 3.5 -Python 3.2
Added file: http://bugs.python.org/file35244/issue2052.diff

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



[issue2052] Allow changing difflib._file_template character encoding.

2014-05-13 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


Added file: http://bugs.python.org/file35245/issue2052_html5.diff

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



[issue21057] TextIOWrapper does not support reading bytearrays or memoryviews

2014-05-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Note that this is not work with the punycode encoding (and may be some 
third-party encodings).

--

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



[issue21486] optimize v4 v6 netmask parsing

2014-05-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Why not just use functools.lru_cache?

--
nosy: +serhiy.storchaka

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



[issue21486] optimize v4 v6 netmask parsing

2014-05-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Because that would incur the cost of LRU logic and locking, which we don't need 
here.

--

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



[issue21501] submitting mmap example for use in documentation

2014-05-13 Thread Steve Foley

Steve Foley added the comment:

sorry! this is the correct version ;-)

---

import mmap, os, select

NUM_CHILDREN = 30
MSG_LEN = 9
BUF_LEN = NUM_CHILDREN * MSG_LEN

buf = mmap.mmap(-1, BUF_LEN)
p = select.poll()

def write_buffer(i):
msg = '%s\t%d\n' % (i, os.getpid())
offset = MSG_LEN * i
buf.seek(offset)
buf.write(msg)

def child(i, pipeout):
write_buffer(i)
os.write(pipeout, 'OK\0'.encode())
os._exit(0)

def fork(i, p):
pipein, pipeout = os.pipe()
if os.fork() == 0:
child(i, pipeout)
else:
p.register(pipein)

def loop(msgs, p):
msgs = NUM_CHILDREN
while msgs:
for fd, event in p.poll():
p.unregister(fd)
msgs = msgs - 1


for i in range(NUM_CHILDREN):
fork(i, p)

loop(NUM_CHILDREN, p)

buf.seek(0)
print buf.read(BUF_LEN)

--

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



[issue18877] tkinter askopenfilenames does not work in Windows library folder

2014-05-13 Thread AJNeufeld

AJNeufeld added the comment:

I'd like this issue to be reopened.  It does not appear resolved.  It is 
different from the wantobjects=False issue.

Windows 7 has 'libraries' which are folders containing the contents of more 
than one folder.  For instance, on my computer
Libraries  Documents
presents the contents of the following 2 folders simultaneously:
   C:\Users\aneufeld\Documents
   C:\Users\Public\Documents

If you execute the script listed in the original bug report, press the [File 
Open] button, press Libraries from the left bar, double click Documents in 
the main area, and select one or more *FILES* in the displayed list of files, I 
get back:
   ('',)

On the other hand, if I press Computer on the left bar, and navigate through 
C:, Users, aneufeld, My Documents, and select the SAME FILES, I get 
back:
   ('C:/Users/aneufeld/Documents/timelog.txt', 
'C:/Users/aneufeld/Documents/notes.txt')

From the  Libraries  Documents folder, if you navigate into any real 
folder, the problem goes away.  For example, with the folder ATS in My 
Documents, press the [File Open] button, press Libraries from the left bar, 
double click Documents in the main area, double click ATS, and select the 
two files, I get:
   ('C:/Users/aneufeld/Documents/ATS/readme.txt', 
'C:/Users/aneufeld/Documents/ATS/Changes.txt')

The issue is, when the file Foo.txt is selected in a Library folder, such as 
Documents, the dialog does not know if that file should be:
   C:/Users/aneufeld/Documents/Foo.txt
or
   C:/Users/Public/Documents/Foo.txt
and returns a null string for the filename.

--
nosy: +AJNeufeld

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



[issue21495] Sane default for logging config

2014-05-13 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +vinay.sajip

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



[issue21496] pyvenv activate_this.py

2014-05-13 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +vinay.sajip

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



[issue21402] tkinter.ttk._val_or_dict assumes tkinter._default_root exists

2014-05-13 Thread Stephen Paul Chappell

Stephen Paul Chappell added the comment:

It seems that most functions and methods do not bother checking if 
_default_root exists before trying to access it. However, upon seeing line 366 
in ttk (if tkinter._support_default_root:), my recommendation would be to 
change line 319 to if tkinter._support_default_root and 
tkinter._default_root: to fix the problem. Several similar lines appear in 
tkinter\__init__.py at locations 1835, 1845, and 2050.

--

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



[issue15871] Online docs: make index search always available.

2014-05-13 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

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



[issue16108] Include maintainer information in register/upload

2014-05-13 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

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



[issue20051] PA-RISC buildbot: compiler cannot create executables

2014-05-13 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

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



[issue13669] XATTR_SIZE_MAX and XATTR_LIST_MAX undefined on kfreebsd/debian with eglibc

2014-05-13 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

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



[issue2552] test_ctypes failed Python 2.6a2 Solaris 10 SUN C

2014-05-13 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

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



  1   2   >