[issue23410] Document more BaseHTTPRequestHandler attributes

2015-02-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f9ff2a5bbbe2 by Benjamin Peterson in branch '3.4':
document the requestline and close_connection attributes, use real booleans, 
and add tests (closes #23410)
https://hg.python.org/cpython/rev/f9ff2a5bbbe2

New changeset 6e3e252cf047 by Benjamin Peterson in branch 'default':
merge 3.4 (#23410)
https://hg.python.org/cpython/rev/6e3e252cf047

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue23472] Setup locales on buildbots

2015-02-17 Thread Serhiy Storchaka

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


--
nosy: +lemburg, loewis

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



[issue23476] SSL cert verify fail for www.verisign.com

2015-02-17 Thread John Nagle

John Nagle added the comment:

Add cert file for testing.  Source of this file is

http://curl.haxx.se/ca/cacert.pem

--
Added file: http://bugs.python.org/file38166/cacert.pem

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



[issue18986] Add a case-insensitive case-preserving dict

2015-02-17 Thread Martin Panter

Martin Panter added the comment:

I will be interested to see those reasons. Another way to do a similar thing 
might be using a Key(value, transform) class, somewhat along the lines of Issue 
20632, but as a separate class rather than part of the core type system. But I 
have not thought that idea through very much.

--

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



[issue23428] Use the monotonic clock for thread conditions on POSIX platforms

2015-02-17 Thread STINNER Victor

STINNER Victor added the comment:

Oh, I missed the issue #12822 which looks to fix similar bugs.

--

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



[issue18986] Add a case-insensitive case-preserving dict

2015-02-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

FYI, the PEP for this isn't going to be accepted (I'm working on the write-up 
for the reasons why and will post on python-dev).   That said, it would be 
great if the code continues to be improved and then posted on the Python 
Package Index.

--

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



[issue23476] SSL cert verify fail for www.verisign.com

2015-02-17 Thread John Nagle

John Nagle added the comment:

To try this with the OpenSSL command line client, use this shell command:

openssl s_client -connect www.verisign.com:443 -CAfile cacert.pem

This provides more detailed error messages than Python provides.

verify error:num=20:unable to get local issuer certificate is the OpenSSL 
error for www.verisign.com.  The corresponding Python error is [SSL: 
CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581).

--

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



[issue6532] thread.get_ident() should return unsigned value

2015-02-17 Thread STINNER Victor

STINNER Victor added the comment:

On Linux, the following C program tells me that pthread_t is unsigned.
---
#include pthread.h
#include stdio.h

#define TYPE_IS_SIGNED(TYPE) ((TYPE)-1  (TYPE)0)

int main()
{
printf(signed? %i\n, TYPE_IS_SIGNED(pthread_t));
return 0;
}
---

So it's fair to modify threading.get_ident() to return an unsigned number.

But I disagree to change stable Python versions, it may break applications.

Oh, I wrote write_thread_id() in Python/traceback.c and this function already 
casts the thread identifier to an unsigned number ;-)

--
nosy: +haypo
versions: +Python 3.5 -Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue23476] SSL cert verify fail for www.verisign.com

2015-02-17 Thread John Nagle

New submission from John Nagle:

SSL certificate verification fails for www.verisign.com when using the cert 
list from Firefox. Other sites (google.com, python.org) verify fine. 

This may be related to a known, and fixed, OpenSSL bug. See:

http://rt.openssl.org/Ticket/Display.html?id=2732user=guestpass=guest
https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1014640 

Some versions of OpenSSL are known to be broken for cases where there multiple 
valid certificate trees.  This happens when one root cert is being phased out 
in favor of another, and cross-signing is involved.

Python ships with its own copy of OpenSSL on Windows.  Tests
for www.verisign.com

Win7, x64:

   Python 2.7.9 with OpenSSL 1.0.1j 15 Oct 2014. FAIL
   Python 3.4.2 with OpenSSL 1.0.1i 6 Aug 2014.  FAIL
   openssl s_client -OpenSSL 1.0.1h 5 Jun 2014   FAIL

Ubuntu 14.04 LTS, x64, using distro's versions of Python:

   Python 2.7.6 - test won't run, needs create_default_context
   Python 3.4.0 with OpenSSL 1.0.1f 6 Jan 2014.  FAIL
   openssl s_client  OpenSSL 1.0.1f 6 Jan 2014   PASS

That's with the same cert file in all cases. The OpenSSL version for Python 
programs comes from ssl.OPENSSL_VERSION. 

The Linux situation has me puzzled.  On Linux, Python is supposedly using the 
system version of OpenSSL. The versions match.  Why do Python and the OpenSSL 
command line client disagree?  Different options passed to OpenSSL by Python?

A simple test program and cert file are attached.  Please try this in your 
environment.

--
components: Library (Lib)
files: ssltest.py
messages: 236158
nosy: nagle
priority: normal
severity: normal
status: open
title: SSL cert verify fail for www.verisign.com
versions: Python 2.7, Python 3.4
Added file: http://bugs.python.org/file38165/ssltest.py

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



[issue6532] thread.get_ident() should return unsigned value

2015-02-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is updated patch. Added few tests.

--
Added file: http://bugs.python.org/file38167/thread_id_unsigned_3.patch

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



[issue23427] Python should expose command when invoked with -c

2015-02-17 Thread R. David Murray

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


--
nosy: +r.david.murray

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



[issue23474] Enhance locale testing

2015-02-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7ef372f656d1 by Serhiy Storchaka in branch '2.7':
Issue #23474: Enhanced locale testing.
https://hg.python.org/cpython/rev/7ef372f656d1

New changeset b53aadd9cf85 by Serhiy Storchaka in branch '3.4':
Issue #23474: Enhanced locale testing.
https://hg.python.org/cpython/rev/b53aadd9cf85

New changeset 4f7c5349e801 by Serhiy Storchaka in branch 'default':
Issue #23474: Enhanced locale testing.
https://hg.python.org/cpython/rev/4f7c5349e801

--
nosy: +python-dev

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



[issue23474] Enhance locale testing

2015-02-17 Thread Serhiy Storchaka

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


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

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



[issue22928] HTTP header injection in urrlib2/urllib/httplib/http.client

2015-02-17 Thread Demian Brecht

Demian Brecht added the comment:

I’ve updated the patch to include the latin-1 charset in legal header values. 
It still uses a space as delimiter, but all other comments should now be 
addressed.

--
Added file: http://bugs.python.org/file38158/issue22928_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22928
___diff -r d12c7938c4b0 Doc/library/http.client.rst
--- a/Doc/library/http.client.rst   Mon Feb 16 13:33:32 2015 +0200
+++ b/Doc/library/http.client.rst   Tue Feb 17 07:55:09 2015 -0800
@@ -292,10 +292,10 @@
 
 .. method:: HTTPConnection.putheader(header, argument[, ...])
 
-   Send an :rfc:`822`\ -style header to the server.  It sends a line to the 
server
-   consisting of the header, a colon and a space, and the first argument.  If 
more
-   arguments are given, continuation lines are sent, each consisting of a tab 
and
-   an argument.
+   Send an :rfc:`7230`\ -style header to the server.  It sends a line to the 
server
+   consisting of the header, a colon and a space, and the first argument. If
+   more arguments are given, they are appended to the header value, each
+   prepended with a single space.
 
 
 .. method:: HTTPConnection.endheaders(message_body=None)
diff -r d12c7938c4b0 Lib/http/client.py
--- a/Lib/http/client.pyMon Feb 16 13:33:32 2015 +0200
+++ b/Lib/http/client.pyTue Feb 17 07:55:09 2015 -0800
@@ -71,6 +71,7 @@
 import http
 import io
 import os
+import re
 import socket
 import collections
 from urllib.parse import urlsplit
@@ -87,6 +88,7 @@
 
 _UNKNOWN = 'UNKNOWN'
 
+
 # connection states
 _CS_IDLE = 'Idle'
 _CS_REQ_STARTED = 'Request-started'
@@ -107,6 +109,36 @@
 _MAXLINE = 65536
 _MAXHEADERS = 100
 
+# Header name/value ABNF (http://tools.ietf.org/html/rfc7230#section-3.2)
+#
+# VCHAR  = %x21-7E
+# obs-text   = %x80-FF
+# header-field   = field-name : OWS field-value OWS
+# field-name = token
+# field-value= *( field-content / obs-fold )
+# field-content  = field-vchar [ 1*( SP / HTAB ) field-vchar ]
+# field-vchar= VCHAR / obs-text
+#
+# obs-fold   = CRLF 1*( SP / HTAB )
+#; obsolete line folding
+#; see Section 3.2.4
+
+# token  = 1*tchar
+#
+# tchar  = ! / # / $ / % /  / ' / *
+#/ + / - / . / ^ / _ / ` / | / ~
+#/ DIGIT / ALPHA
+#; any VCHAR, except delimiters
+#
+# VCHAR defined in http://tools.ietf.org/html/rfc5234#appendix-B.1
+
+_HEADER_LEGAL_NAME = re.compile(b'^[!#$%\'*+-.^_`|~a-zA-z0-9]+$')
+# 0x20 (sp) is included in the valid character range for backwards
+# compatibility, where header values with spaces (i.e. auth headers) are passed
+# through to putheader as single values. latin-1 charset is also legal as ASCII
+# is only suggested in RFC 7230
+_HEADER_LEGAL_VALUE = re.compile(b'^\s*[\x20-\x7E\xA0-\xFF]*\s*$')
+
 
 class HTTPMessage(email.message.Message):
 # XXX The only usage of this method is in
@@ -1000,13 +1032,35 @@
 
 if hasattr(header, 'encode'):
 header = header.encode('ascii')
+
+if not _HEADER_LEGAL_NAME.match(header):
+raise ValueError('Invalid header name {!r}'.format(header))
+
 values = list(values)
 for i, one_value in enumerate(values):
 if hasattr(one_value, 'encode'):
-values[i] = one_value.encode('latin-1')
+encoded_value = one_value.encode('latin-1')
 elif isinstance(one_value, int):
-values[i] = str(one_value).encode('ascii')
-value = b'\r\n\t'.join(values)
+encoded_value = str(one_value).encode('ascii')
+else:
+encoded_value = one_value
+
+# Newly defined header fields SHOULD limit their field values to
+# US-ASCII octets. A recipient SHOULD treat other octets in field
+# content (obs-text) as opaque data.
+if not _HEADER_LEGAL_VALUE.match(encoded_value):
+raise ValueError(
+'Invalid header value {}'.format(encoded_value))
+
+values[i] = encoded_value
+
+# http://tools.ietf.org/html/rfc7230#section-3.2.4 states that line
+# folding is obsolete, unless message/http MIME type is used and rules
+# are conformed to. otherwise, spaces should be used. it might be a
+# good idea to put validation for this rule in sometime in the future.
+# as it currently stands, there's no way to determine the MIME type of
+# the message at this point.
+value = b' '.join(values)
 header = header + b': ' + value
 self._output(header)
 
diff -r d12c7938c4b0 Lib/test/test_httplib.py
--- a/Lib/test/test_httplib.py  Mon Feb 16 13:33:32 2015 +0200
+++ b/Lib/test/test_httplib.py  Tue Feb 17 07:55:09 2015 -0800
@@ -171,6 +171,17 @@
 

[issue18610] wsgiref.validate expects wsgi.input read to give exactly one arg

2015-02-17 Thread PJ Eby

PJ Eby added the comment:

This is a misreading of the spec.  The read() method is defined as taking 
exactly one parameter.  The server *should* support it being optional, but the 
app invoking it without an argument is not compliant, and wsgiref.validate is 
validating that the *app* performs according to spec, not the server.

Therefore, the documentation is what's in error, not the code.

--
assignee:  - docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
stage: patch review - needs patch

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



[issue23473] Allow namedtuple to be JSON encoded as dict

2015-02-17 Thread Zack

New submission from Zack:

We used to be able to override _iterencode prior to 2.7 to get our namedtuples 
to be encoded as dict using json.dump(s) but now we can not.

Namedtuples are automatically encoded as list but it would be more logical and 
convenient to have them encoded as dict

--
messages: 236139
nosy: Zack--, ezio.melotti, pitrou, rhettinger
priority: normal
severity: normal
status: open
title: Allow namedtuple to be JSON encoded as dict
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

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



[issue23472] Setup locales on buildbots

2015-02-17 Thread Jeremy Kloth

Changes by Jeremy Kloth jeremy.kloth+python-trac...@gmail.com:


--
nosy: +jkloth

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



[issue21998] asyncio: support fork

2015-02-17 Thread Martin Richard

Martin Richard added the comment:

In that case, I suggest a small addition to your patch that would do the trick:

in unix_events.py:
+def _at_fork(self):
+super()._at_fork()
+self._selector._at_fork()
+self._close_self_pipe()
+self._make_self_pipe()
+

becomes:

+def _at_fork(self):
+super()._at_fork()
+if not hasattr(self._selector, '_at_fork'):
+return
+self._selector._at_fork()
+self._close_self_pipe()
+self._make_self_pipe()

--

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



[issue23472] Setup locales on buildbots

2015-02-17 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Tests use following locales:

test_types: en_US.UTF-8
test_codecs: tr_TR
test_decimal: ps_AF
test_float: fr_FR or de_DE
test_imaplib: de_DE or fr_FR
test_locale: (en_US.UTF-8, en_US.ISO-8859-1, en_US.US-ASCII, or en_US), tr_TR
test_pickle: de_DE or fr_FR
test_re: en_US.ISO-8859-1, en_US.UTF-8
test_strptime: en_US.UTF-8, de_DE.UTF-8
test_time: fr_FR
test_unicode: de_DE or fr_FR

And test__locale uses locales from the long list.

So it would be good to setup following locales on all buildbots:

en_US, en_US.UTF-8, en_US.ISO-8859-1, en_US.ISO-8859-1, en_US.US-ASCII, de_DE, 
de_DE.UTF-8, fr_FR, tr_TR, ps_AF

--
components: Tests
messages: 236135
nosy: ezio.melotti, michael.foord, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Setup locales on buildbots
type: enhancement

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



[issue21998] asyncio: support fork

2015-02-17 Thread STINNER Victor

STINNER Victor added the comment:

 It will (obviously) not work with python 3.4 since self._selector won't have 
 an _at_fork() method.

asyncio doc contains:
The asyncio package has been included in the standard library on a provisional 
basis. Backwards incompatible changes (up to and including removal of the 
module) may occur if deemed necessary by the core developers.

It's not the case for selectors. Even if it would be possible to implement 
selector._at_fork() in asyncio, it would make more sense to implement it in the 
selectors module.

@neologix: Would you be ok to add a *private* _at_fork() method to selectors 
classes in Python 3.4 to fix this issue?

I know that you are not a fan of fork, me neither, but users like to do crazy 
things with fork and then report bugs to asyncio :-)

--
nosy: +neologix

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



[issue23067] Export readline forced_update_display

2015-02-17 Thread Olivier Matz

Olivier Matz added the comment:

By the way, I have my own implementation of the patch that did before checking 
the issue tracker. Instead of adding an argument to readline.redisplay(), it 
adds a new function readline.forced_update_display().

I attach the patch for reference, I don't know what is the preferred way to add 
this feature.

--
Added file: 
http://bugs.python.org/file38163/readline_add_forced_update_display.patch

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



[issue22623] Missing guards for some POSIX functions

2015-02-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

3.2 and 3.3 are only for security fixes now.

--
nosy: +serhiy.storchaka
versions:  -Python 3.2, Python 3.3

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



[issue22623] Missing guards for some POSIX functions

2015-02-17 Thread Link Mauve

Changes by Link Mauve b...@linkmauve.fr:


Added file: http://bugs.python.org/file38161/getedig.patch

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



[issue18610] wsgiref.validate expects wsgi.input read to give exactly one arg

2015-02-17 Thread Robin Schoonover

Robin Schoonover added the comment:

I'm not sure I follow, as it has little to say on whether the application's 
expected behavior here, and only a recommendation that the server allow it.  
But, it also defers to the Python Standard Library, which does have an 
opinion.  I feel that (in hindsight) the exact behavior of each method should 
have been specified in full.

*However*, even if I differ on the reading of the spec, on general principle 
(and this has changed since I first wrote the issue) I agree that the 
application should not be omitting it anyway, because reading the entire 
response at once without checking the content length is dangerous.

--

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



[issue2528] Change os.access to check ACLs under Windows

2015-02-17 Thread Mark Lawrence

Mark Lawrence added the comment:

The solution proposed here could help resolve #22107.

--
nosy: +BreamoreBoy

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



[issue22623] Missing guards for some POSIX functions

2015-02-17 Thread Link Mauve

Link Mauve added the comment:

Removed the unwanted introduced function, and added a comment signaling the end 
of the HAVE_TTYNAME #ifdef.

The full patch is attached, the diff with the previous version can be found at 
http://linkmauve.fr/files/getedig.patch

--
Added file: http://bugs.python.org/file38160/getedig.patch

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



[issue23474] Enhance locale testing

2015-02-17 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch enhance locale testing. test__locale is converted to support 
unittest discovery. When there are no suitable locales (e.g. there is only 
POSIX locale) tests are reported as skipped. Tested thousands_sep with 
non-english locales. Tested non-ascii values of decimal_point and thousands_sep 
with the ps_AF locale. In test_locale Turkish locale test no longer break a 
line.

--
components: Tests
files: test__locale.patch
keywords: patch
messages: 236141
nosy: lemburg, loewis, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Enhance locale testing
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file38159/test__locale.patch

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



[issue21998] asyncio: support fork

2015-02-17 Thread Charles-François Natali

Charles-François Natali added the comment:

 @neologix: Would you be ok to add a *private* _at_fork() method to selectors 
 classes in Python 3.4 to fix this issue?

Not really: after fork(), you're hosed anyway:


   Q6  Will closing a file descriptor cause it to be removed from
all epoll sets automatically?

   A6  Yes, but be aware of the following point.  A file
descriptor is a reference to an open file  description
   (see open(2)).  Whenever a descriptor is duplicated via
dup(2), dup2(2), fcntl(2) F_DUPFD, or fork(2), a
   new file descriptor referring to the same open file
description is created.  An  open  file  description
   continues  to  exist  until all file descriptors referring
to it have been closed.  A file descriptor is
   removed from an epoll set only after all the file
descriptors referring  to  the  underlying  open  file
   description  have  been  closed  (or  before  if the
descriptor is explicitly removed using epoll_ctl(2)
   EPOLL_CTL_DEL).  This means that even after a file
descriptor that is part of  an  epoll  set  has  been
   closed,  events may be reported for that file descriptor if
other file descriptors referring to the same
   underlying file description remain open.


What would you do with the selector after fork(): register the FDs in
a new epoll, remove them?

There's no sensible default behavior, and I'd rrather avoid polluting
the code for this.
If asyncio wants to support this, it can create a new selector and
re-register everything it wants manually: there's a Selector.get_map()
exposing all that's needed.

--

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



[issue22107] tempfile module misinterprets access denied error on Windows

2015-02-17 Thread Mark Lawrence

Mark Lawrence added the comment:

The feedback here 
https://mail.python.org/pipermail/python-dev/2011-May/111530.html seems 
positive.  It references #2528 which is still open but strikes me as the way 
forward.  Why don't we go for it and nail this issue once and for all?

--

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



[issue22107] tempfile module misinterprets access denied error on Windows

2015-02-17 Thread Roger Upole

Roger Upole added the comment:

It doesn't actually do anything, so why do it at all?  In order to distinguish 
why it failed, you might try checking if the file actually exists, and if it is 
a folder.

--

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



[issue23067] Export readline forced_update_display

2015-02-17 Thread Olivier Matz

Olivier Matz added the comment:

Hi,

I'm also interrested in this feature. Indeed, exporting 
rl_forced_update_display() is the only way I've found to make 
readline.set_completion_display_matches_hook() working properly. Without 
forcing the redisplay, the prompt is not displayed. This seems to be the proper 
function to call, because that's the one called at the end of display_matches() 
in libreadline code, which is the default function for displaying matches.

The attached file is a simple example code derived from 
http://pymotw.com/2/readline/ that shows that the patch is working.

--
nosy: +zer0
Added file: http://bugs.python.org/file38162/test-rdline.py

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



[issue2528] Change os.access to check ACLs under Windows

2015-02-17 Thread Serhiy Storchaka

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


--
nosy: +serhiy.storchaka

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



[issue21998] asyncio: support fork

2015-02-17 Thread STINNER Victor

STINNER Victor added the comment:

2015-02-17 20:16 GMT+01:00 Charles-François Natali rep...@bugs.python.org:
 What would you do with the selector after fork(): register the FDs in
 a new epoll, remove them?

See the patch:

+def _at_fork(self):
+# don't unregister file descriptors: epoll is still shared with
+# the parent process
+self._epoll = select.epoll()
+for key in self._fd_to_key.values():
+self._register(key)

EpollSelector._at_fork() does nothing on the current epoll object,
create a new epoll object and register again all file descriptor.

Hum, I should maybe close explicitly the old epoll object.

 There's no sensible default behavior, and I'd rrather avoid polluting
 the code for this.

What is wrong with the proposed patch?

 If asyncio wants to support this, it can create a new selector and
 re-register everything it wants manually: there's a Selector.get_map()
 exposing all that's needed.

If possible, I would prefer to implement at fork in the selectors
module directly, the selectors module has a better knowledge of
seletors. For example, asyncio is not aware of the selector._epoll
attribute.

--

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



[issue23474] Enhance locale testing

2015-02-17 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 17.02.2015 19:34, Serhiy Storchaka wrote:
 
 Proposed patch enhance locale testing. test__locale is converted to support 
 unittest discovery. When there are no suitable locales (e.g. there is only 
 POSIX locale) tests are reported as skipped. Tested thousands_sep with 
 non-english locales. Tested non-ascii values of decimal_point and 
 thousands_sep with the ps_AF locale. In test_locale Turkish locale test no 
 longer break a line.

Look good. Thanks, Serhiy.

--

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



[issue21998] asyncio: support fork

2015-02-17 Thread Martin Richard

Martin Richard added the comment:

The goal of the patch is to create a duplicate selector (a new epoll() 
structure with the same watched fds as the original epoll). It allows to remove 
fds watched in the child's loop without impacting the parent process.

Actually, it's true that with the current implementation of the selectors 
module (using get_map()), we can achieve the same result than with victor's 
patch without touching the selector module. I attached a patch doing that, also 
working with python 3.4.

I thought about this at_fork() mechanism a bit more and I'm not sure of what we 
want to achieve with this. In my opinion, most of the time, we will want to 
recycle the loop in the child process (close it and create a new one) because 
we will not want to have the tasks and callbacks scheduled on the loop running 
on both the parent and the child (it would probably result in double writes on 
sockets, or double reads, for instance).

With the current implementation of asyncio, I can't recycle the loop for a 
single reason: closing the loop calls _close_self_pipe() which unregisters the 
pipe of the selector (hence breaking the loop in the parent). Since the self 
pipe is an object internal to the loop, I think it's safe to close the pipes 
without unregistering them of the selector. It is at least true with epoll() 
according to the documentation quoted by neologix, but I hope that we can 
expect it to be true with other unix platforms too.

--
Added file: http://bugs.python.org/file38164/at_fork-3.patch

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



[issue21998] asyncio: support fork

2015-02-17 Thread STINNER Victor

STINNER Victor added the comment:

How do other event loops handle fork? Twisted, Tornado, libuv, libev,
libevent, etc.

--

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



[issue23475] asyncio: reference leak in test_close_kill_running()

2015-02-17 Thread STINNER Victor

New submission from STINNER Victor:

The test_close_kill_running() test of test.test_asyncio.test_subprocess leaks 
references. It may be a reference cycle.

--
haypo@selma$ ./python -Wall -b -m test.regrtest -R 3:3:refleaks -m 
test_close_kill_running test_asyncio 
[1/1] test_asyncio
beginning 6 repetitions
123456
..
test_asyncio leaked [388, 388, 388] references, sum=1164
test_asyncio leaked [84, 85, 85] memory blocks, sum=254
1 test failed:
test_asyncio
--

See also the issue #23353.

Note: test_close_dont_kill_finished() doesn't leak.

--
components: asyncio
messages: 236152
nosy: gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: reference leak in test_close_kill_running()
versions: Python 3.4, Python 3.5

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



[issue22883] Get rid of references to PyInt in Py3 sources

2015-02-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2f0c1937d716 by Serhiy Storchaka in branch 'default':
Issue #22883: Got rid of outdated references to PyInt and PyString in comments.
https://hg.python.org/cpython/rev/2f0c1937d716

New changeset c8d08de14030 by Serhiy Storchaka in branch '3.4':
Issue #22883: Update PyInt to PyLong in C API example.
https://hg.python.org/cpython/rev/c8d08de14030

New changeset c0b2dacef35c by Serhiy Storchaka in branch 'default':
Issue #22883: Update PyInt to PyLong in C API example.
https://hg.python.org/cpython/rev/c0b2dacef35c

--
nosy: +python-dev

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



[issue23237] Interrupts are lost during readline PyOS_InputHook processing (reopening)

2015-02-17 Thread Serhiy Storchaka

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


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

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



[issue22883] Get rid of references to PyInt in Py3 sources

2015-02-17 Thread Serhiy Storchaka

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


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

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



[issue9099] multiprocessing/win32: WindowsError: [Error 0] Success on Pipe()

2015-02-17 Thread Davin Potts

Davin Potts added the comment:

Though the code may have changed a bit in the meantime (Issue11750 in 
particular), the calls to _winapi.SetNamedPipeHandleState in 
Lib/multiprocessing/connection.py are still present and largely the same as 
when this issue was first opened.

The implementation of _winapi.SetNamedPipeHandleState still has the potential 
to raise a WindowsError with its message (i.e. e.args[0]) set to whatever the 
Windows GetLastError() function returns.  My reading of the MSDN docs and the 
code in Modules/_winapi.c is as follows:
1. A WindowsError exception is raised only if the Windows function 
SetNamedPipeHandleState returns 0.
2. The Windows function SetNamedPipeHandleState only returns 0 if it failed.
3. When that function fails, the Windows function GetLastError is expected to 
return a non-zero value to provide insight on the nature of the failure.
4. MSDN docs suggest that some functions may call SetLastError with 0 to 
indicate success (seen when subsequently calling GetLastError).  This creates a 
bit of a conundrum given what the OP observed in the provided traceback:  the 
Windows function SetNamedPipeHandleState failed yet the call to GetLastError 
returned a 0.

Possibly the MSDN docs are incomplete on this specific matter and/or there 
could be other environmental factors on the system(s) where this issue has been 
observed not to mention other wrinkles from the OP's reported use of Cython to 
embed the Python interpreter to trigger the issue.  A google search for other 
situations triggering this same behavior did turn up mentions of encountering 
it inside the Wine environment running on Ubuntu -- debugging Wine's 
re-implementation of Windows APIs is certainly out-of-scope here.  It is 
possible that this issue is caused by environmental issues and may not be 
possible to provoke in a supported standard Windows system environment.  
Without a test case or some other way to provoke or reproduce the issue, there 
is little capability to pursue this further.

The OP kindly followed up several years ago to say that he could not find a way 
to reproduce the issue reliably.  Given that, the above review of the code, and 
the search results from looking for other instances of this sort of issue, I am 
going ahead with closing this issue.

--
nosy: +davin
resolution:  - rejected
stage: test needed - resolved
status: open - closed

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



[issue23475] asyncio: reference leak in test_close_kill_running()

2015-02-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0f6ddf944521 by Victor Stinner in branch '3.4':
Issue #23475, asyncio: Fix test_close_kill_running()
https://hg.python.org/cpython/rev/0f6ddf944521

--
nosy: +python-dev

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



[issue23475] asyncio: reference leak in test_close_kill_running()

2015-02-17 Thread STINNER Victor

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


--
resolution:  - fixed
status: open - closed

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



[issue21998] asyncio: support fork

2015-02-17 Thread Martin Richard

Martin Richard added the comment:

I read the patch, it looks good to me for python 3.5. It will (obviously) not 
work with python 3.4 since self._selector won't have an _at_fork() method.

I ran the tests on my project with python 3.5a1 and the patch, it seems to work 
as expected: ie. when I close the loop of the parent process in the child, it 
does not affect the parent.

I don't have a case where the loop of the parent is still used in the child 
though.

--

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



[issue22107] tempfile module misinterprets access denied error on Windows

2015-02-17 Thread Tim Golden

Tim Golden added the comment:

And, just to be clear to Serhiy who I know doesn't use Windows,
os.access really is a worthless function in its present form: worse,
even, because it can be misleading. I have a long-standing patch to
convert it to use AccessCheck but I've never quite had the guts to
commit it because I fear the breakage would be too great.

--

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



[issue23425] Windows getlocale unix-like with french, german, portuguese, spanish

2015-02-17 Thread albertjan

albertjan added the comment:

Hi, 

Thanks for your replies. Eryksun (nice to meet you here too!), your function 
seems very useful, thank you very much. I had indeed already switched to your 
'getrawlocale' approach.

Perhaps off-topic (because I have never seen this happen in Windows), but 
locale.getlocale() sometimes returns (None, None), *even if* 
locale.setlocale(locale.LC_ALL, ) has been called at the start of the 
program. For some reason, LANG, LC_ALL and possible other vars are sometimes 
not set correctly (I know this is not Python's fault, but...). Would it be a 
good idea to have a 'failsafe' parameter in getlocale? Something like:

def safe_getlocale(failsafe=False):
current_locale = locale.getlocale()
if failsafe and current_locale[0] is None and not 
sys.platform.startswith(win):
os.environ[LANG] = en_US.UTF-8
os.environ[LC_ALL] = en_US.UTF-8
current_locale = locale.getlocale()
 return current_locale

(sorry for squeezing this in the current issue!)

Albert-Jan

--

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



[issue22107] tempfile module misinterprets access denied error on Windows

2015-02-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The main issue is not tempfile raises a FileExistsError, but that it hangs for 
several seconds (for example if the temp dir doesn't exist). The patch allows 
to fail early and try other temp dir.

os.access() is not enough, we can add os.path.isdir(). Could you please run 
tests on patched Python on Windows and say what tests are failed?

--

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