[issue812369] module shutdown procedure based on GC

2013-08-21 Thread Antoine Pitrou

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


--
superseder: module shutdown procedure based on GC - Stop purging modules which 
are garbage collected before shutdown

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



[issue18790] incorrect text in argparse add_help example

2013-08-21 Thread Michael Bikovitsky

Changes by Michael Bikovitsky moshe.b...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file31393/doc_fix.patch

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



[issue18790] incorrect text in argparse add_help example

2013-08-21 Thread Michael Bikovitsky

Changes by Michael Bikovitsky moshe.b...@gmail.com:


--
nosy: +Michael.Bikovitsky

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



[issue18794] select.devpoll objects have no close() method

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

Charles-François Natali added the comment:

Just to be explicit (there are typos in Victor's original messages): it's about 
select.devpoll, for Solaris-derivatives with /dev/poll, and not for 
select.poll, based on poll() syscall.

--

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



[issue16853] add a Selector to the select module

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

Charles-François Natali added the comment:

 I've lost track -- who is waiting for whom?  I reviewed the patch 
 selector-12.diff and received zero response AFAICT.  (Maybe the email from 
 Rietveld didn't make it?)

I was on vacation, and then had to cope with many emails :-)
I'll update the patch with your comments soon.

 Maybe the main issue is that I would prefer if the selector classes were in a 
 separate module (selectors.py) than the low-level select/poll/etc. calls.  I 
 think it makes sense if the selectors module *only* defines the high level 
 classes and not the messy low-level stuff, since an app shouldn't be using 
 both at the same time.

I agree with Antoine (i.e. I think select is OK), but if it really
bothers you, I can change it.
I just don't want to do it twice :-)

--

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



[issue18792] test_ftplib timeouts

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

Charles-François Natali added the comment:

 Some ftplib tests sometimes time out. Seem they seem to try to connect to 
 localhost (rather than 127.0.0.1), I was wondering if this could be a DNS 
 issue and if we should resolve localhost in advance like Charles-François 
 did for some other tests (or simply hardcode 127.0.0.1, actually).

If it only happens on Windows = 7 buildbots, then it's likely a
consequence of this:
http://serverfault.com/questions/4689/windows-7-localhost-name-resolution-is-handled-within-dns-itself-why

Apparently, since Windows 7, localhost doesn't appear in the hosts
file anymore: so, depending on your DNS resolver settings, this could
perfectly explain such timeouts (assuming it's not a firewall issue).

Hard-cording 127.0.0.1 for this test should be OK, because the server
setup explicitly binds an AF_INET socket. We'll probably have to check
the rest of the test suite for similar issues.

--

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



[issue18797] Don't needlessly change refcounts of dummy objects for sets

2013-08-21 Thread Raymond Hettinger

New submission from Raymond Hettinger:

AFAICT, there is no reason for sets to incref and decref dummy objects.  The 
dummy object address is used as placeholders in the hash table but it is never 
accessed by set the logic.   As long the one reference is held at the time the 
dummy object is created, nothing further is served by the increfs and decrefs.

I can take them out entirely or use ifdefs to keep them for debug builds.

Does anyone know of any issues?

--
components: Interpreter Core
files: no_refcnt_dummy1.diff
keywords: patch
messages: 195751
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Don't needlessly change refcounts of dummy objects for sets
type: performance
versions: Python 3.4
Added file: http://bugs.python.org/file31394/no_refcnt_dummy1.diff

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



[issue18792] test_ftplib timeouts

2013-08-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Hard-cording 127.0.0.1 for this test should be OK, because the server
 setup explicitly binds an AF_INET socket. We'll probably have to check
 the rest of the test suite for similar issues.

Ok, let's do it!

--
keywords: +easy

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



[issue18797] Don't needlessly change refcounts of dummy objects for sets

2013-08-21 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
nosy: +pitrou

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



[issue18797] Don't needlessly change refcounts of dummy objects for sets

2013-08-21 Thread Antoine Pitrou

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


--
nosy: +Mark.Shannon, tim.peters

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



[issue18797] Don't needlessly change refcounts of dummy objects for sets

2013-08-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I can't think of any counter-indication but I think we shouldn't distinguish 
between debug and non-debug mode. That way the debug hooks can check that the 
refcounting optimization is right.

--

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



[issue18792] test_ftplib timeouts

2013-08-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch for default.

--
keywords: +patch
Added file: http://bugs.python.org/file31395/support_host.patch

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



[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-21 Thread Serhiy Storchaka

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


--
dependencies: +PyNumber_Index() is not int-subclass friendly (or 
operator.index() docos lie)

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



[issue18793] occasional test_multiprocessing_forkserver failure on FreeBSD 10.0

2013-08-21 Thread koobs

koobs added the comment:

Antoine, did you see: #18762 ? It references the samee failures on 9.x as well.

Do you want to close this as a dupe, or maintain separate issues for each OS?

--

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



[issue18793] occasional test_multiprocessing_forkserver failure on FreeBSD 10.0

2013-08-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ha, you're right, we can close this one as a duplicate.

--
superseder:  - error in test_multiprocessing_forkserver

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



[issue18794] select.devpoll objects have no close() method

2013-08-21 Thread STINNER Victor

STINNER Victor added the comment:

Just to be explicit (there are typos in Victor's original messages): it's 
about select.devpoll, for Solaris-derivatives with /dev/poll, and not for 
select.poll, based on poll() syscall.

Oops sorry, yes, I'm talking about select.devpoll, its structure has a int 
fd_devpoll; field:

typedef struct {
PyObject_HEAD
int fd_devpoll;
int max_n_fds;
int n_fds;
struct pollfd *fds;
} devpollObject;

--

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



[issue14971] (unittest) loadTestsFromName does not work on method with a decorator

2013-08-21 Thread Michael Foord

Michael Foord added the comment:

Cool, thanks!

--
assignee:  - michael.foord

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



[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

2013-08-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yet some nitpicks.

Currently the code of _PyLong_FromNbInt() is inlined and the do_decref flag is 
used to prevent needless change refcounts of int objects (see also issue18797). 
In proposed patch common code is extracted into the _PyLong_FromNbInt() 
function and int objects increfed and decrefed. Doesn't it affect a 
performance? PyLong_As* functions used in arguments parsing in a lot of 
builtins and their .performance is important.

If the patch slowdowns PyLong_As* functions we perhaps should check 
PyLong_CheckExact() before calling _PyLong_FromNbInt() and use the do_decref 
flag.

In general the idea and the patch LGTM.

--

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



[issue16853] add a Selector to the select module

2013-08-21 Thread STINNER Victor

STINNER Victor added the comment:

I like the idea of renaming select to _select, and add Lib/select.py
for the high-level wrapper (Selector). In my opinion, adding a module
just for 5 classes is overkill. Selector classes are a very thin
abstraction over the low-level objects. A new module can be justified
for something more evolved, something like an event loop with
callbacks and a scheduler, something like the PEP 3156 (tulip) :-)

This issue is for code written in Python. Is it a similar issue for
code written in C? internal_select_ex() of Modules/socketmodule.c and
check_socket_and_wait_for_timeout() of Modules/_ssl.c uses poll() and
select().

--

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



[issue18794] select.devpoll objects have no close() method

2013-08-21 Thread Serhiy Storchaka

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


--
nosy: +serhiy.storchaka
stage:  - needs patch

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



[issue18713] Enable surrogateescape on stdin and stdout when appropriate

2013-08-21 Thread R. David Murray

R. David Murray added the comment:

I think the essential use case is using a python program in a unix pipeline.  
I'm very sympathetic to that use case, despite my unease.

--

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



[issue18795] pstats - allow stats sorting by cumulative time per call and total time per call

2013-08-21 Thread R. David Murray

R. David Murray added the comment:

I believe the module already supports sorting by time and cumulative time 
(determining the top consumers of cpu is a major part of the point of the 
profile module, after all).  

What exactly is the change that you are proposing?  If you post a diff instead 
of a modified copy of the module it would be easier to see what you are 
proposing.

--
nosy: +r.david.murray

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



[issue18795] pstats - allow stats sorting by cumulative time per call and total time per call

2013-08-21 Thread Alexandre Dias

Alexandre Dias added the comment:

It does support sorting by total time and cumulative time spent on a function, 
but not by the time per each call of that function.

I've uploaded a diff of the patch.

-Alexandre

--
versions: +Python 3.4 -Python 2.7
Added file: http://bugs.python.org/file31396/pstats-diff-issue18795.txt

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



[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

2013-08-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

On PyPy 1.8.0 operator.index(True) returns 1.

--

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



[issue18792] test_ftplib timeouts

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

Charles-François Natali added the comment:

Changing support.HOST from 'localhost' to '127.0.0.1' means that on dual-stack
hosts (I don't think the test suite would run on IPv6-only hosts anyway), the
tests will now always use IPv4, whereas they are currently using either IPv6 or
IPv4 addresses depending on the host's name resolution settings.
For example, on a RHEL6 box:

 socket.getaddrinfo('localhost', 0)
[(10, 1, 6, '', ('::1', 0, 0, 0)), (10, 2, 17, '', ('::1', 0, 0, 0)),
(10, 3, 0, '', ('::1', 0, 0, 0)), (2, 1, 6, '', ('127.0.0.1', 0)), (2,
2, 17, '', ('127.0.0.1', 0)), (2, 3, 0, '', ('127.0.0.1', 0))]

So on this host, 'localhost' resolves to '::1'. I think it would be
better to have support.HOST set to socket.getaddrinfo('localhost', 0)[0][4][0]
(sic), so that the test will use the preferred protocol on the target host, and
also that IPv6 is also tested in tests which don't explicitely use
'::1'. But this
means that we should have an support.HOSTv4 for tests that explicitly rely on
IPv4, e.g.  test_ftplib.

--

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



[issue18795] pstats - allow stats sorting by cumulative time per call and total time per call

2013-08-21 Thread R. David Murray

R. David Murray added the comment:

It would be clearer, I think, to call it average time.  I must admit to not 
being sure why that is useful.  I'm also worried there might be backward 
compatibility issues with changing the ordering of the data structure.  If new 
fields are going to be added they should probably be added at the end.

--

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



[issue18794] select.devpoll objects have no close() method

2013-08-21 Thread STINNER Victor

STINNER Victor added the comment:

This all sounds fine to fix without waiting for anything else -- can you 
attach a patch here?

I opened the issue as a reminder for me. Here is a patch.

 * Add close() and fileno() methods and a closed attribute (property) to 
devpoll object
 * Document closed attribute of epoll and kqueue objects
 * Add tests on closed object for devpoll, epoll and kqueue. There was no test 
for devpoll, epoll nor kqueue :-(

select.poll is still not tested. We should add much more tests, especially 
tests checking than a fd becomes ready for each implementation. We may develop 
these tests using #16853 ?

I ran test_select on Linux, so I only checked the epoll unit test.

The closed attribute of epoll and kqueue objects should also be documented in 
Python 2.7 and 3.3.

--
keywords: +patch
Added file: http://bugs.python.org/file31397/devpoll_close.patch

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



[issue18798] Typo and unused variables in test fcntl

2013-08-21 Thread Vajrasky Kok

New submission from Vajrasky Kok:

Typo in line 11:
# Skip test if no fnctl module.

Unused variables rv in test_fcntl_file_descriptor method.

Attached the patch to clean up the test.

--
components: Tests
files: fix_typo_unused_variables_in_test_fcntl.patch
keywords: patch
messages: 195768
nosy: vajrasky
priority: normal
severity: normal
status: open
title: Typo and unused variables in test fcntl
versions: Python 3.4
Added file: 
http://bugs.python.org/file31398/fix_typo_unused_variables_in_test_fcntl.patch

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



[issue18713] Enable surrogateescape on stdin and stdout when appropriate

2013-08-21 Thread STINNER Victor

STINNER Victor added the comment:

Currently, Python 3 fails miserabily when it gets a non-ASCII
character from stdin or when it tries to write a byte encoded as a
Unicode surrogate to stdout.

It works fine when OS data can be decoded from and encoded to the
locale encoding. Example on Linux with UTF-8 data and UTF-8 locale
encoding:

$ mkdir test
$ cd test
$ touch héhé.txt
$ ls
héhé.txt
$ python3 -c 'import os; print(, .join(os.listdir()))'
héhé.txt
$ echo héhé|python3 -c 'import sys; sys.stdout.write(sys.stdin.read())'|cat
héhé

It fails miserabily when OS data cannot be decoded from or encoded to
the locale encoding. Example on Linux with UTF-8 data and ASCII locale
encoding:

$ mkdir test
$ cd test
$ touch héhé.txt
$ export LANG=  # switch to ASCII locale encoding
$ ls
h??h??.txt
$ python3 -c 'import os; print(, .join(os.listdir()))'
Traceback (most recent call last):
  File string, line 1, in module
UnicodeEncodeError: 'ascii' codec can't encode characters in position
1-2: ordinal not in range(128)

$ echo héhé|LANG= python3 -c 'import sys;
sys.stdout.write(sys.stdin.read())'|cat
Traceback (most recent call last):
  File string, line 1, in module
  File /home/vstinner/prog/python/default/Lib/encodings/ascii.py,
line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
1: ordinal not in range(128)

The ls output is not the expected héhé string, but it is an issue
with the console output, not the ls program. ls does just write raw
bytes to stdout:

$ ls|hexdump -C
  68 c3 a9 68 c3 a9 2e 74  78 74 0a |h..h...txt.|
000b

(héhé encoded to UTF-8 gives b'h\xc3\xa9h\xc3\xa9')

I agree that we can do something to improve the situation on standard
streams, but only on standard streams. It is already possible to
workaround the issue by forcing the surrogateescape error handler on
stdout:

$ LANG= PYTHONIOENCODING=utf-8:surrogateescape python3 -c 'import os;
print(, .join(os.listdir()))'
héhé.txt

Something similar can be done in Python. For example,
test.support.regrtest reopens sys.stdout to set the error handle to
backslashreplace. Extract of the replace_stdout() function:

sys.stdout = open(stdout.fileno(), 'w',
encoding=sys.stdout.encoding,
errors=backslashreplace,
closefd=False,
newline='\n')

--

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



[issue18792] test_ftplib timeouts

2013-08-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Changing support.HOST from 'localhost' to '127.0.0.1' means that on
 dual-stack
 hosts (I don't think the test suite would run on IPv6-only hosts
 anyway), the
 tests will now always use IPv4, whereas they are currently using
 either IPv6 or
 IPv4 addresses depending on the host's name resolution settings.

That would only be true if the server we are contacting happens to
listen on both IPv6 and IPv4, right? I don't think we have such a
situation in the test suite. Clients can use create_connection()
for transparent support of IPv6 and IPv4, but servers have to choose
a family when creating their socket.

--

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



[issue18794] select.devpoll objects have no close() method

2013-08-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

poll, devpoll, epoll and kqueue are tested in test_poll.py, test_devpoll.py, 
test_epoll.py and test_kqueue.py test files.

--

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



[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

2013-08-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And yet one nitpick. For int subclasses which doesn't overload the __int__ 
method the patch calls default int.__int__ which creates a copy of int object. 
This is redundant in PyLong_As* functions because they only extract C int value 
and drop Python int object. So we can use int subclass object itself as good as 
int object.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17576
___
___
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-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 print(member)
 %s % member
 {}.format(member)

 Would you seriously use either of those last two in either the debugger 
or the command line?

Yes, of course. When you need debug output from function or loop inners.

for ...:
...
print('stage1(%s) = [%s:%s] %s' % (i, start, stop, result))

--

___
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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8e1194c39bed by Christian Heimes in branch '3.3':
Issue #18747: Re-seed OpenSSL's pseudo-random number generator after fork.
http://hg.python.org/cpython/rev/8e1194c39bed

New changeset 49e23a3adf26 by Christian Heimes in branch 'default':
Issue #18747: Re-seed OpenSSL's pseudo-random number generator after fork.
http://hg.python.org/cpython/rev/49e23a3adf26

New changeset 2e6aa6c29be2 by Christian Heimes in branch '2.7':
Issue #18747: Re-seed OpenSSL's pseudo-random number generator after fork.
http://hg.python.org/cpython/rev/2e6aa6c29be2

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18747
___
___
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-21 Thread Serhiy Storchaka

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


--
stage: commit review - patch review

___
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



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

2013-08-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I'm proposing to split this issue on two issues. One for C-style formatting (I 
guess everyone agree that '%i' % int-like object should return decimal 
representation of its numerical value) and other for format() which is more 
questionable.

--

___
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



[issue17916] Provide dis.Bytecode based equivalent of dis.distb

2013-08-21 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Here's a basic patch, using a classmethod. It doesn't support the full distb 
API (if the traceback is not given, try to retrieve the last one), because 
Bytecode.from_tb() looks pretty weird.

--
keywords: +patch
nosy: +Claudiu.Popa
Added file: http://bugs.python.org/file31399/dis.patch

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-21 Thread Christian Heimes

Christian Heimes added the comment:

I have taken care of Antoine's and Victor's reviews. The fix has landed in 
Python 2.7, 3.3 and 3.4. What about 2.6, 3.1 and 3.2? After all it's a security 
fix (although I don't consider its severity as high).

--
nosy: +barry, benjamin.peterson, georg.brandl
stage: patch review - commit review
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue18792] test_ftplib timeouts

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

Charles-François Natali added the comment:

 That would only be true if the server we are contacting happens to
 listen on both IPv6 and IPv4, right? I don't think we have such a
 situation in the test suite.

Ah, I thought some code was using getaddrinfo() to select an arbitrary
bind() address for localhost.

That's OK then.

--

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



[issue18780] SystemError when formatting int subclass

2013-08-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think we should just use PyNumber_ToBase() for any int and int subclass. The 
calling __str__() for special case looks weird.

--

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-21 Thread STINNER Victor

STINNER Victor added the comment:

3.52 +#if 0
3.53 +fprintf(stderr, PySSL_RAND_atfork_child() seeds %i
bytes in pid %i\n,
3.54 +(int)sizeof(seed), seed.pid);
3.55 +#endif

Don't you want to remove this debug code?

 1.8 +def test_random_fork(self):
 1.9 +status = ssl.RAND_status()
1.10 +if not status:
1.11 +self.fail(OpenSSL's PRNG has insufficient randomness)

The test uses ssl.RAND_pseudo_bytes(), the check on ssl.RAND_status()
must be removed.

--

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



[issue18747] Re-seed OpenSSL's PRNG after fork

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

Charles-François Natali added the comment:

 Christian Heimes added the comment:

 I have taken care of Antoine's and Victor's reviews. The fix has landed in 
 Python 2.7, 3.3 and 3.4. What about 2.6, 3.1 and 3.2? After all it's a 
 security fix (although I don't consider its severity as high).

There's still the #if 0 in the patch you committed.

And basically, because PySSL_RAND_atfork_child() is not async-signal
safe, the interpreter is now subject to random deadlocks/crash in
multi-threaded processes. I personally don't consider this a security
fix...

--

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



[issue15809] IDLE console uses incorrect encoding.

2013-08-21 Thread irdb

irdb added the comment:

Sorry, it's probably has the same problem as what Martin suggested. Although I 
think it's better than having program interrupted.

--

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-21 Thread Christian Heimes

Christian Heimes added the comment:

Am 21.08.2013 14:08, schrieb Charles-François Natali:
 And basically, because PySSL_RAND_atfork_child() is not async-signal
 safe, the interpreter is now subject to random deadlocks/crash in
 multi-threaded processes. I personally don't consider this a security
 fix...

Which part of the function is not async-signal safe? It doesn't interact
with any file descriptors nor does it use any syscalls except for
getpid() and time().

Python's _ssl module doesn't re-initialize its locks on fork. That's an
outstanding issue that is not related to the change.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18747
___
___
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-21 Thread Ethan Furman

Ethan Furman added the comment:

Serhiy Storchaka added the comment:

 I'm proposing to split this issue on two issues. One for C-style formatting 
 (I guess everyone agree that '%i' % int-like object should return decimal 
 representation of its numerical value) and other for format() which is more 
 questionable.

Not sure that's necessary.  The code to fix the C-style %-formatting is 
already (I think)  in the last patch I attached.

--

___
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



[issue18747] Re-seed OpenSSL's PRNG after fork

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

Charles-François Natali added the comment:

 Which part of the function is not async-signal safe? It doesn't interact
 with any file descriptors nor does it use any syscalls except for
 getpid() and time().

gettimeofday() and RAND_add()

The functions which are guaranteed to be async-signal safe are listed here:
https://www.securecoding.cert.org/confluence/display/seccode/SIG30-C.+Call+only+asynchronous-safe+functions+within+signal+handlers

And here's what David Butenhof says about pthread_atfork():

The real answer is that pthread_atfork() is a completely useless and stupid
mechanism that was a well intentioned but ultimately pointless attempt to
carve a back door solution out of an inherently insoluable design
conflict.


More here:
https://groups.google.com/forum/#!msg/comp.programming.threads/ThHE32-vRsg/3j-YICgSQzoJ

IMO it's really an openssl issue, and it should be fixed there (mainly
because they are the only one in position of setuping a safe
atfork-hook, like the glibc does for malloc  co).

--

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-21 Thread Christian Heimes

Christian Heimes added the comment:

Do you have a proposal for a better way to fix the issue? I don't think that we 
can hope for a fix from OpenSSL.

--

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Do you have a proposal for a better way to fix the issue? I don't
 think that we can hope for a fix from OpenSSL.

Instead of reseeding in the child, you can perturb the state in the parent
after fork. As far as I understand, only the child callback in
pthread_atfork() needs to be async-signal-safe:

It is suggested that programs that use fork() call an exec function
very soon afterwards in the child process, thus resetting all states.
In the meantime, only a short list of async-signal-safe library
routines are promised to be available.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_atfork.html

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18747
___
___
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-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Not sure that's necessary.  The code to fix the C-style %-formatting is 
already (I think)  in the last patch I attached.

Could you please extract this part of the patch and add tests? It can be 
reviewed and committed separately. See also issue18780, there is a more serious 
problem with current code.

--

___
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-21 Thread Eric V. Smith

Eric V. Smith added the comment:

I agree splitting this makes sense, so as to not delay the %-formatting fix. 
While similar in principle, the fixes are unrelated. We may as well keep this 
issue the __format__ part, since it's been most discussed here.

--

___
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-21 Thread Eli Bendersky

Eli Bendersky added the comment:

On Wed, Aug 21, 2013 at 6:40 AM, Eric V. Smith rep...@bugs.python.orgwrote:


 Eric V. Smith added the comment:

 I agree splitting this makes sense, so as to not delay the %-formatting
 fix. While similar in principle, the fixes are unrelated. We may as well
 keep this issue the __format__ part, since it's been most discussed here.


+1

$REALLIFE took over in the past few days but I'll be back towards the
weekend and want to review this part too.

--

___
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



[issue15809] IDLE console uses incorrect encoding.

2013-08-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 How about passing on UnicodeError?

I don't see how it will resolve any problem.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15809
___
___
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-21 Thread Eli Bendersky

Eli Bendersky added the comment:

Serhiy, if you feel this is related to #18780 maybe they can be merged into a 
single issue (since the comment on #18780 says the fix here will work there 
too)?

--

___
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-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I rather think that two discussions about two almost unrelated series of 
patches in same issue will be confused.

--

___
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



[issue18780] SystemError when formatting int subclass

2013-08-21 Thread Serhiy Storchaka

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


--
nosy: +barry, eli.bendersky, eric.smith, ethan.furman

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



[issue18713] Enable surrogateescape on stdin and stdout when appropriate

2013-08-21 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/issue18713
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15809] IDLE console uses incorrect encoding.

2013-08-21 Thread irdb

irdb added the comment:

Oops! My problem is that I get Unsupported characters in input when trying to 
type any Unicode string in IDLE's interactive mode.

e.g. a simple command like: s = u'Русский текст' gives: Unsupported characters 
in input

Probably unrelated to the issue at hand. I don't know how I ended up in this 
thread. Again, sorry.

--

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



[issue18747] Re-seed OpenSSL's PRNG after fork

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

Charles-François Natali added the comment:

2013/8/21 Antoine Pitrou rep...@bugs.python.org:
 Instead of reseeding in the child, you can perturb the state in the parent
 after fork.
 As far as I understand, only the child callback in pthread_atfork() needs 
 to be async-signal-safe:

That's not completely true: fork() is supposed to be async-signal
safe: it can be called from a signal handler (I wouldn't do this, but
that's allowed), but most notably, it can be called after another
fork().
For example, let's say you have a multi-threaded process, and it
fork()s. If you reseed from parent (right before or after fork),
then it's safe. But once you're in the child process, the process
state is unsafe until exec(), i.e. you can only call async-signal
safe functions. So if you fork() again before exec() - which is
common, e.g. if you use the double-fork() idiom for daemons - then
you'll call the reseed in an unsafe context. In other words, the
parent callback is called in the context of a child callback in
the child process.

So it's not really safe either, although the window is narrower.

The only 100% safe way I can think of - apart from ignoring the
problem - would be to check if the PID has changed upon entering ssl
function (caching it to avoid calling getpid() everytime), keeping in
mind that there will still be the risk of deadlock/crash anyway if the
user enters the ssl library before exec()...

Another, probably cleaner way would be to finally add the atfork()
module (issue #16500), and register this reseed hook (which could then
be implemented in ssl.py).

forking() in a multi-threaded context is an unsolvable problem...

--

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-21 Thread Richard Oudkerk

Richard Oudkerk added the comment:

On 21/08/2013 3:46pm, Charles-François Natali wrote:
 Another, probably cleaner way would be to finally add the atfork()
 module (issue #16500), and register this reseed hook (which could then
 be implemented in ssl.py).

Wouldn't that still suffer from the double-fork() issue?

--

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 [snip insightful explanation]
 So it's not really safe either, although the window is narrower.

Gosh. Well, the narrower window would be fine with me :-)

--

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



[issue18772] Fix gdb plugin for new sets dummy object

2013-08-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Antoine, can you please verify the gdb plug-in is working again?

--

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



[issue18799] Resurrect and fix test_404 in Lib/test/test_xmlrpc.py

2013-08-21 Thread Vajrasky Kok

New submission from Vajrasky Kok:

There is a dormant test in Lib/test/test_xmlrpc.py (line 579):

# [ch] The test 404 is causing lots of false alarms.
def XXXtest_404(self):
# send POST with http.client, it should return 404 header and
# 'Not Found' message.
conn = httplib.client.HTTPConnection(ADDR, PORT)
conn.request('POST', '/this-is-not-valid')
response = conn.getresponse()
conn.close()

self.assertEqual(response.status, 404)
self.assertEqual(response.reason, 'Not Found')

I decided to test it by removing 'XXX' and adding 'import httplib'. Yes, it 
hung up.

But then I looked at its sibling:

def test_partial_post(self):
# Check that a partial POST doesn't make the server loop: issue #14001.
conn = http.client.HTTPConnection(ADDR, PORT)
conn.request('POST', '/RPC2 HTTP/1.0\r\nContent-Length: 100\r\n\r\nbye')
conn.close()

I tried to use http module instead of httplib. It works. I tested it on Linux 
and Windows Vista. It works on both platforms.

Attached the patch to fix the resurrect and fix the test_404.

--
components: Tests
files: fix_test_404.patch
keywords: patch
messages: 195800
nosy: vajrasky
priority: normal
severity: normal
status: open
title: Resurrect and fix test_404 in Lib/test/test_xmlrpc.py
versions: Python 3.4
Added file: http://bugs.python.org/file31401/fix_test_404.patch

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



[issue16853] add a Selector to the select module

2013-08-21 Thread Guido van Rossum

Guido van Rossum added the comment:

On Wed, Aug 21, 2013 at 2:37 AM, STINNER Victor rep...@bugs.python.orgwrote:


 STINNER Victor added the comment:

 I like the idea of renaming select to _select, and add Lib/select.py
 for the high-level wrapper (Selector). In my opinion, adding a module
 just for 5 classes is overkill. Selector classes are a very thin
 abstraction over the low-level objects. A new module can be justified
 for something more evolved, something like an event loop with
 callbacks and a scheduler, something like the PEP 3156 (tulip) :-)


OK, I'm just going to impose my decision. I want a separate selectors.py.
The rename business feels unpleasant, *and* the interface abstraction level
is different.

 This issue is for code written in Python. Is it a similar issue for
 code written in C? internal_select_ex() of Modules/socketmodule.c and
 check_socket_and_wait_for_timeout() of Modules/_ssl.c uses poll() and
 select().


Let's leave those alone. AFAIK they are mostly to simulate timeouts in
*blocking* code.

--

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-21 Thread Christian Heimes

Christian Heimes added the comment:

Oh heck, signal, threads and fork really don't mix. :(
Under which condition can a non-async safe function cause trouble? Is it just 
fork() inside a signal handler or can an incoming signal during fork() also 
cause havoc?

The OpenSSL PRNG is only buggy when used in a forking application where the 
master process initializes the PRNG but never uses it. All child processes 
inherit the same state. OpenSSL tries to work around the problem by feeding the 
PID into the PRNG state. But as soon as PIDs get recycled, subsequent child 
processes get the same random numbers.

Antoine's proposal works, too, because it perturbs the master's PRNG state 
regularly.

--

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



[issue15233] atexit: guarantee order of execution of registered functions?

2013-08-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 84d74eb7a341 by Charles-François Natali in branch '2.7':
Issue #15233: Python now guarantees that callables registered with the atexit
http://hg.python.org/cpython/rev/84d74eb7a341

--

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



[issue18747] Re-seed OpenSSL's PRNG after fork

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

Charles-François Natali added the comment:

 Another, probably cleaner way would be to finally add the atfork()
 module (issue #16500), and register this reseed hook (which could then
 be implemented in ssl.py).

 Wouldn't that still suffer from the double-fork() issue?

Not for the officially supported way of creating child processes,
subprocess, since it calls fork() + exec() from C.
The problem with pthread_atfork() is that it would make the whole
interpreter non-safe even for correct code paths that call fork() +
exec(), which is not the case now.

Not reseeding with pthread_atfork() or atfork module, but only when
the ssl library is entered, just means that if a deadlock must occur,
it will only occur if the process re-enters the ssl library after
fork().

 Under which condition can a non-async safe function cause trouble? Is it just 
 fork() inside a signal handler or can an incoming signal during fork() also 
 cause havoc?

Actually, it doesn't need a signal to cause havoc: imagine that thread
A is inside an ssl function, holding a mutex protecting process-wide
internal ssl data. Then, thread B forks: in the child process, the ssl
mutex is already held (since the adress space is COW), so upon next
ssl library call in the child, the process will deadlock (trying to
acquire a mutex already held). That's an example with lock, but the
same holds if the library uses a global/static variable, etc. As an
approximation, sync-signal safe means reentrant (async-signal safe
comes from the fact that such restrictions apply to signal handler,
for the exact same reasons).

So you can pretty much only use reentrant functions between fork() and
exec() in a multi-threaded process (i.e. no malloc(), no strtok()...).
Which basically means that you can't run Python code at all between
fork() and exec() in a multi-threaded code.

--

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



[issue15233] atexit: guarantee order of execution of registered functions?

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

Charles-François Natali added the comment:

Backported to 2.7.

--
resolution:  - fixed
stage: commit review - committed/rejected
status: open - closed
versions:  -Python 3.2

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



[issue18792] test_ftplib timeouts

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

Charles-François Natali added the comment:

LGTM

--

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



[issue18799] Resurrect and fix test_404 in Lib/test/test_xmlrpc.py

2013-08-21 Thread R. David Murray

R. David Murray added the comment:

A lot of false alarms means usually it works, but then sometimes it doesn't.  
So just testing it on a couple of platforms isn't sufficient, unfortunately.

--
nosy: +r.david.murray

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



[issue18800] Document Fraction's numerator and denominator properties

2013-08-21 Thread icedream91

New submission from icedream91:

The document (http://docs.python.org/3/library/fractions.html) doesn't mention 
Fraction's numerator and denominator properties, I knew these properties from 
dir().

Since sometimes these two properties are very useful, for example: 
http://projecteuler.net/problem=33 and http://projecteuler.net/problem=57 , I 
think document should mention them. 

Thanks.

--
assignee: docs@python
components: Documentation
messages: 195808
nosy: docs@python, icedream91
priority: normal
severity: normal
status: open
title: Document Fraction's numerator and denominator properties
type: enhancement
versions: Python 3.3

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



[issue12641] Remove -mno-cygwin from distutils

2013-08-21 Thread Oscar Benjamin

Oscar Benjamin added the comment:

I just noticed today that the fix that implemented by these patches
(only providing -mno-cygwin if gcc_ver  4) is also used by numpy's
distutils. You can see the relevant code here:

https://github.com/numpy/numpy/blob/master/numpy/distutils/mingw32ccompiler.py#L117

The relevant commit was three years ago:

https://github.com/numpy/numpy/commit/9dd7c7b8ad826beefbbc0c10ff457c62f1be223d

They haven't bothered with checking for cygwin gcc (my patches only do
this to try and show a helpful error message).

--

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



[issue18763] subprocess: file descriptors should be closed after preexec_fn is called

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

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


--
nosy: +sbt

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



[issue18797] Don't needlessly change refcounts of dummy objects for sets

2013-08-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

 I think we shouldn't distinguish between debug and non-debug mode.

That makes good sense.
Attaching a new patch without the #ifdefs.

--
Added file: http://bugs.python.org/file31402/no_refcnt_dummy2.diff

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



[issue16611] Cookie.py does not parse httponly or secure cookie flags

2013-08-21 Thread R. David Murray

R. David Murray added the comment:

Backward compatibility is a concern.  However, having the flags test true when 
present, which they don't currently, should be considered a bug fix, I think.

So, I added a some tests to confirm the current behavior, and wrote a new patch 
that *just* fixes the 'test true if present' bug, leaving the other behaviors 
unchanged.  Reviews appreciated.  And if anyone can think of tests I missed, 
please let me know; I'm a little nervous about the regex change (I hate dealing 
with regexes :)

This issue was originally about other bugs as well, but I'm changing the title 
to reflect just this fix.  If there are still other remaining bugs, please open 
a new issues for them.

Thanks for the patch, Julien.  Although I didn't use your code, it did inform 
my work.

--
stage: needs patch - patch review
title: multiple problems with Cookie.py - Cookie.py does not parse httponly or 
secure cookie flags
versions: +Python 3.3, Python 3.4
Added file: http://bugs.python.org/file31403/cookie_flags.patch

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



[issue16611] Cookie.py does not parse httponly or secure cookie flags

2013-08-21 Thread R. David Murray

R. David Murray added the comment:

Woops, corrupted patch, and I see a bug...

--

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



[issue16611] Cookie.py does not parse httponly or secure cookie flags

2013-08-21 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


Removed file: http://bugs.python.org/file31403/cookie_flags.patch

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



[issue18780] SystemError when formatting int subclass

2013-08-21 Thread Ethan Furman

Ethan Furman added the comment:

I'll get my patch separated and over here when I get back home (on a business 
trip at the moment).

--

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



[issue16611] Cookie.py does not parse httponly or secure cookie flags

2013-08-21 Thread R. David Murray

R. David Murray added the comment:

Corrected patch.

--
Added file: http://bugs.python.org/file31405/cookie_flags.patch

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



[issue18794] select.devpoll objects have no close() method

2013-08-21 Thread STINNER Victor

STINNER Victor added the comment:

Updated patch: move tests to the right test files and test that close() can be 
called more than once.

--
Added file: http://bugs.python.org/file31404/devpoll_close-2.patch

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



[issue18793] occasional test_multiprocessing_forkserver failure on FreeBSD 10.0

2013-08-21 Thread Richard Oudkerk

Changes by Richard Oudkerk shibt...@gmail.com:


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

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



[issue6923] Need pthread_atfork-like functionality in CPython

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

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


--
resolution:  - duplicate
stage: needs patch - committed/rejected
status: open - closed
superseder:  - Add an 'atfork' module

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



[issue18762] error in test_multiprocessing_forkserver

2013-08-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e1fdd79cfb01 by Richard Oudkerk in branch 'default':
Issue #18762: Print debug info on failure to create new forkserver process.
http://hg.python.org/cpython/rev/e1fdd79cfb01

--
nosy: +python-dev

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



[issue18794] select.devpoll objects have no close() method

2013-08-21 Thread Guido van Rossum

Changes by Guido van Rossum gu...@python.org:


--
nosy:  -gvanrossum

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



[issue17119] Integer overflow when passing large string or tuple to Tkinter

2013-08-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6bc533d06cf1 by Serhiy Storchaka in branch '3.3':
Issue #17119: Fixed integer overflows when processing large strings and tuples
http://hg.python.org/cpython/rev/6bc533d06cf1

New changeset b500daaee7d0 by Serhiy Storchaka in branch 'default':
Issue #17119: Fixed integer overflows when processing large strings and tuples
http://hg.python.org/cpython/rev/b500daaee7d0

New changeset ee0bb673536c by Serhiy Storchaka in branch '2.7':
Issue #17119: Fixed integer overflows when processing large Unicode strings
http://hg.python.org/cpython/rev/ee0bb673536c

--
nosy: +python-dev

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



[issue12641] Remove -mno-cygwin from distutils

2013-08-21 Thread vengefulgash45

Changes by vengefulgash45 turkeysa...@gmail.com:


Added file: http://bugs.python.org/file31406/test1.html

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



[issue15175] pydoc -k zip throws segmentation fault

2013-08-21 Thread Serhiy Storchaka

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


--
status: open - pending

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



[issue12641] Remove -mno-cygwin from distutils

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

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


--
title: Test - Remove -mno-cygwin from distutils

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



[issue12641] Test

2013-08-21 Thread fancyguidebook6

Changes by fancyguidebook6 turkeysa...@gmail.com:


--
title: Remove -mno-cygwin from distutils - Test
Added file: http://bugs.python.org/file31407/test1.html

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



[issue16938] pydoc confused by __dir__

2013-08-21 Thread Eric Snow

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


--
nosy: +eric.snow

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



[issue12641] Test

2013-08-21 Thread spiffykismet73

Changes by spiffykismet73 turkeysa...@gmail.com:


--
title: Remove -mno-cygwin from distutils - Test
Added file: http://bugs.python.org/file31408/test1.html

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



[issue17972] inspect module docs omits many functions

2013-08-21 Thread Eric Snow

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


--
nosy: +eric.snow

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



[issue12641] Test

2013-08-21 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


Removed file: http://bugs.python.org/file31406/test1.html

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



[issue12641] Test

2013-08-21 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


Removed file: http://bugs.python.org/file31407/test1.html

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



[issue12641] Test

2013-08-21 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


Removed file: http://bugs.python.org/file31408/test1.html

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



[issue18801] inspect.classify_class_attrs() misclassifies object.__new__()

2013-08-21 Thread Eric Snow

New submission from Eric Snow:

 pprint.pprint(inspect.classify_class_attrs(object))
[Attribute(name='__class__', kind='data', defining_class=class 'object', 
object=attribute '__class__' of 'object' objects),
...
 Attribute(name='__init__', kind='method', defining_class=class 'object', 
object=slot wrapper '__init__' of 'object' objects),
...
 Attribute(name='__new__', kind='data', defining_class=class 'object', 
object=built-in method __new__ of type object at 0x8aee20),
...
]

I haven't had a chance to look into why __new__() falls through the cracks but 
expect it's due to how __new__() is treated like a staticmethod without being 
one.  I suppose there could be other similar cases, but __new__() is probably 
the only oddball here.

An extra test using isbuiltin() fixes this.

 else:
 obj_via_getattr = getattr(cls, name)
 if (ismethod(obj_via_getattr) or
-ismethoddescriptor(obj_via_getattr)):
+ismethoddescriptor(obj_via_getattr) or
+isbuiltin(obj_via_getattr)):
 kind = method
 else:
 kind = data

--
components: Library (Lib)
messages: 195818
nosy: eric.snow
priority: normal
severity: normal
stage: test needed
status: open
title: inspect.classify_class_attrs() misclassifies object.__new__()
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue12641] Remove -mno-cygwin from distutils

2013-08-21 Thread Christian Heimes

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


--
title: Test - Remove -mno-cygwin from distutils

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



[issue18795] pstats - allow stats sorting by cumulative time per call and total time per call

2013-08-21 Thread Alexandre Dias

Alexandre Dias added the comment:

Average time would indeed be a better description. 

As for its usefulness: let's say that for example you would want to find the 
function in which your code spends the most time on average, in order to later 
optimise said function. If one of the calls to another function has its 
execution time spike momentarily, it will be at the top of the total time 
column on the result. However, that does not necessarily mean that it was the 
function in which on average the most time was spent on, and thus the one that 
the optimisation effort should be focused on.
Also, when seeing the profiling results, I would expect to be able to sort by 
any of the columns shown, and that is currently not possible for the average 
cumulative and total time per call.

Do you mind clarifying your worries with backwards compatibility? Unless I'm 
mistaken, fcn_list is the only outside effect of the method I'm changing. It 
is built from the last element of each tuple in stats_list, whose ordering is 
what I'm proposing to be able to change (thus changing the ordering of the 
function list, but that is already done by other sort options).

--

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



[issue12641] Test

2013-08-21 Thread gaudyallure52

gaudyallure52 added the comment:

Test

--
nosy: +gaudyallure52
title: Remove -mno-cygwin from distutils - Test
Added file: http://bugs.python.org/file31409/test1.html

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



[issue12641] Test

2013-08-21 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
Removed message: http://bugs.python.org/msg195820

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



[issue12641] Test

2013-08-21 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


Removed file: http://bugs.python.org/file31409/test1.html

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



  1   2   >