[issue21965] Add support for Memory BIO to _ssl

2014-08-27 Thread Geert Jansen

Geert Jansen added the comment:

Adding small patch (incremental to patch #4) to fix a test failure.

--
Added file: http://bugs.python.org/file36483/ssl-memory-bio-4-incr1.patch

___
Python tracker 

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



[issue22282] ipaddress module accepts octal formatted IPv4 addresses in IPv6 addresses

2014-08-27 Thread Fabian

New submission from Fabian:

The ipaddress module accepts IPv6 addresses if the IPv4 address is formatted as 
an octal number, but http://tools.ietf.org/html/rfc3986#section-3.2.2 doesn't 
allow leading zeroes in the IPv4 address.

This is the current behaviour (in 3.4.1):

>>> ipaddress.ip_address("::1.0.0.00")
IPv6Address('::100:0')

Expected:

>>> ipaddress.ip_address("::1.0.0.00")
Traceback (most recent call last):
  File "", line 1, in 
  File "3.4.1/lib/python3.4/ipaddress.py", line 54, in ip_address
address)
ValueError: '::1.0.0.00' does not appear to be an IPv4 or IPv6 address

Because I didn't know it better, I first tried to patch the backport but this 
might be still applicable the official code: 
https://github.com/phihag/ipaddress/pull/12

--
messages: 225950
nosy: xZise
priority: normal
severity: normal
status: open
title: ipaddress module accepts octal formatted IPv4 addresses in IPv6 addresses
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue22283] "AMD64 FreeBSD 9.0 3.x" fails to build the _decimal module: #error "libmpdec version >= 2.4.1 required"

2014-08-27 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%203.x/builds/7213/steps/test/logs/stdio

building '_decimal' extension
gcc -pthread -fPIC -fno-strict-aliasing -Wsign-compare -g -O0 -Wall 
-Wstrict-prototypes -Werror=declaration-after-statement -DCONFIG_64=1 -DASM=1 
-I./Include -I. -IInclude -I/usr/local/include 
-I/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Include 
-I/usr/home/buildbot/buildarea/3.x.krah-freebsd/build -c 
/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Modules/_decimal/_decimal.c 
-o 
build/temp.freebsd-9.0-RELEASE-p3-amd64-3.5-pydebug/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Modules/_decimal/_decimal.o
 -Wextra -Wno-missing-field-initializers
/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Modules/_decimal/_decimal.c:43:4:
 error: #error "libmpdec version >= 2.4.1 required"

--
messages: 225951
nosy: haypo, koobs, skrah
priority: normal
severity: normal
status: open
title: "AMD64 FreeBSD 9.0 3.x" fails to build the _decimal module: #error 
"libmpdec version >= 2.4.1 required"
type: compile error

___
Python tracker 

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



[issue22281] ProcessPoolExecutor/ThreadPoolExecutor should provide introspection APIs

2014-08-27 Thread Ram Rachum

Ram Rachum added the comment:

I'd definitely consolidate.

First of all, I'd put a few useful numbers in `Executor.__repr__`. Something 
like . That already 
makes to easy to get a general picture of how the executor is doing without 
digging in too deeply.

Next, I'd make a property `workers` (or if you want to make it a method, that's 
okay). It'll return a list of all the workers, and in their `__repr__` they'll 
have the work item that they're working on. Maybe we could also add 
`idle_workers` and `busy_workers`, then people can call `len` on them. (No 
point in making a function that tells their length if it doesn't expose them 
directly.) Also "active" may not be a clear term, I think that "busy" 
communicates it better, and is shorter to boot.

I'd also add `queued_work_items` and `active_work_items`, and I think that 
takes care of everything.

--
nosy: +cool-RR

___
Python tracker 

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



[issue22283] "AMD64 FreeBSD 9.0 3.x" fails to build the _decimal module: #error "libmpdec version >= 2.4.1 required"

2014-08-27 Thread Stefan Krah

Stefan Krah added the comment:

Yeah, I know -- I have to release libmpdec-2.4.1.  The bot is currently testing
the supported configuration that if _decimal fails to build, decimal.py should
be used automatically.

The tests fail due to #22280, otherwise the bot would be green even with the
_decimal build failure.

--

___
Python tracker 

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



[issue22284] decimal module contains less symbols when the _decimal module is missing

2014-08-27 Thread STINNER Victor

New submission from STINNER Victor:

While investigation issue #22283, I noticed that when the _decimal is present, 
the decimal looses its __all__ attribute. dir(decimal) contains 5 more symbols 
than decimal.__all__:
{'ConversionSyntax',
 'DecimalTuple',
 'DivisionImpossible',
 'DivisionUndefined',
 'InvalidContext'}

These symbols should be added to decimal.__all__, or _decimal should also have 
a __all__ attribute.

--
messages: 225954
nosy: haypo, skrah
priority: normal
severity: normal
status: open
title: decimal module contains less symbols when the _decimal module is missing
versions: Python 3.5

___
Python tracker 

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



[issue22285] The Modules/ directory should not be added to sys.path

2014-08-27 Thread STINNER Victor

New submission from STINNER Victor:

When Python is built from source, the "Modules/" subdirectory is added to 
sys.path on UNIX. I don't understand why: it does not contain .py files nor .so 
dynamic modules. Dynamic modules are built in 
"build/lib.linux-x86_64-3.5-pydebug".

A side effect of adding Modules/ subdirectory to sys.path is that Modules 
subdirectories (ex: _sqlite, _ctypes, _io, _decimal, etc.) can be used as 
packages.

For example, when the _decimal module cannot be compiled, Lib/decimal.py uses 
Modules/_decimal as a Python package which is wrong. The decimal becomes an 
empty module (no symbol, because Modules/_decimal does not contain an 
__init__.py nor any .so file) because decimal.py uses "import _decimal" at the 
end (see decimal.py).

Attached patch removes Modules/ from sys.path on UNIX.

Maybe adding Modules/ to sys.path was useful before the introduction of 
pybuildir.txt? See issue #9589 and the changeset 4742e7aea2f5 (and the issue 
#586680).

--
files: getpath_no_modules.patch
keywords: patch
messages: 225955
nosy: haypo, pitrou
priority: normal
severity: normal
status: open
title: The Modules/ directory should not be added to sys.path
Added file: http://bugs.python.org/file36484/getpath_no_modules.patch

___
Python tracker 

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



[issue22284] decimal module contains less symbols when the _decimal module is missing

2014-08-27 Thread Stefan Krah

Stefan Krah added the comment:

I agree.  I plan to fix this as part of #19232. If decimal.py and
_decimal are split properly, these things show up immediately.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue22284] decimal module contains less symbols when the _decimal module is missing

2014-08-27 Thread Stefan Krah

Changes by Stefan Krah :


--
dependencies: +Speed up _decimal import

___
Python tracker 

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



[issue22285] The Modules/ directory should not be added to sys.path

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

A side effect of this issue is that when the _decimal cannot be build (ex: 
#22283), the Python implementation of the decimal cannot be used. Extract of 
buildbot test logs related to #22283:
---
Failed to build these modules:
_decimal

(...)
  File 
"/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/test_statistics.py",
 line 15, in 
from decimal import Decimal
ImportError: cannot import name 'Decimal'
---
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%203.x/builds/7213/steps/test/logs/stdio

--
nosy: +skrah

___
Python tracker 

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



[issue22280] _decimal: successful import despite build failure

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

Oh, it looks like I opened a similar issue: #22285 (with a patch).

--
nosy: +haypo

___
Python tracker 

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



[issue22285] The Modules/ directory should not be added to sys.path

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

See also issue #22280 for the case of the wrong _decimal package.

--

___
Python tracker 

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



[issue22280] _decimal: successful import despite build failure

2014-08-27 Thread Stefan Krah

Stefan Krah added the comment:

Ah nice, let's continue with your issue then.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> The Modules/ directory should not be added to sys.path

___
Python tracker 

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



[issue22285] The Modules/ directory should not be added to sys.path

2014-08-27 Thread Martin v . Löwis

Martin v. Löwis added the comment:

The motivation for this feature is that modules built as shared libraries 
through Modules/Setup end up in Modules, so Modules is added so that they are 
found.

I'd like to preserve support for building dynamic extension modules through 
Modules/Setup, but they don't have to live in Modules; putting them into build 
(say) would be fine as well.

--
nosy: +loewis

___
Python tracker 

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



[issue22277] webbrowser.py add parameters to suppress output on stdout and stderr

2014-08-27 Thread Cristian Consonni

Cristian Consonni added the comment:

Hi David,

at the moment the other parameters used by the open()[1] - 'new' and 
'autoraise' - have no direct mapping to other subprocess.Popen(), they are 
passed as options to the call for the specific browsers.
(e.g. firefox -new-tab http://www.example.com)

So I am not really sure I understand your request in this respect.

Cristian

[1] https://docs.python.org/3/library/webbrowser.html#webbrowser.open

--

___
Python tracker 

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



[issue22222] dtoa.c: remove custom memory allocator

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

> A modified version of telco.py (using floats instead of decimals)
> runs about 5-6% slower with the change here.

Would it be possible to optimize the pymalloc allocator to reduce this 
slow-down?

--

___
Python tracker 

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



[issue22272] sqlite3 memory leaks in cursor.execute

2014-08-27 Thread A. Libotean

A. Libotean added the comment:

> Can we close this issue then?

Yes, please. Sorry for the false alarm.

--

___
Python tracker 

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



[issue22257] PEP 432: Redesign the interpreter startup sequence

2014-08-27 Thread Nick Coghlan

Nick Coghlan added the comment:

I wouldn't mind heading in that direction at a later stage. PEP 432 is aimed at 
a simpler proposition of breaking things up into two steps:

Step 1: get a functional bytecode compiler and eval loop up and running (only 
builtin and frozen modules available) (this is what "begin initialization" 
would handle)
Step 2: get everything else up and running with the aid of a mostly working 
core C API (this is everything else up to and including "end initialization"). 
In particular, we'd be able to use builtins, like str and list, rather than 
having to manage everything in pure C (or breach the API guarantees by creating 
objects before the interpreter is fully set up, as happens now).

So step 1 will probably need to remain a distinct operation called from the 
embedding application (including the Python CLI itself) but there may be room 
to move in how we get from the beginning of the initialisation process to the 
end.

--

___
Python tracker 

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



[issue22286] Allow backslashreplace error handler to be used on input

2014-08-27 Thread Nick Coghlan

New submission from Nick Coghlan:

In the discussion on issue 18814, Antoine pointed out that in a Python 3 world, 
using backslashescape during decoding actually makes sense - it lets you 
accurately report arbitrary bytes in the sequence, without needing 
surrogateescape or surrogatepass to be used when encoding later.

--
messages: 225966
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Allow backslashreplace error handler to be used on input
type: enhancement
versions: Python 3.5

___
Python tracker 

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



[issue22287] Use clock_gettime() in pytime.c

2014-08-27 Thread STINNER Victor

New submission from STINNER Victor:

On UNIX, time.time() currently uses clock_gettime(), but _PyTime_gettimeofday() 
doesn't becauce pytime.c lacks a dependency on the librt module (needed on some 
platforms).

Attached patch adds the dependency if needed and modify _PyTime_gettimeofday() 
to use clock_gettime() if available.

The patch alone is not very useful. I wrote it to prepare the work for the 
issue #22043 (use a monotonic clock in Python modules written in C).

With the patch, Python depends on the librt on Solaris and on Linux with glibc 
older than 2.17 (clock_gettime is now available directly in the libc since 
glibc 2.17).

--
files: clock_gettime.patch
keywords: patch
messages: 225967
nosy: haypo, loewis, neologix
priority: normal
severity: normal
status: open
title: Use clock_gettime() in pytime.c
versions: Python 3.5
Added file: http://bugs.python.org/file36485/clock_gettime.patch

___
Python tracker 

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



[issue3473] In function call, keyword arguments could follow *args

2014-08-27 Thread Martijn Pieters

Martijn Pieters added the comment:

The documentation change in this patch introduced a bug in the Call grammar:

| "*" `expression` ["," "*" `expression`] ["," "**" `expression`]

instead of

| "*" `expression` ["," `keyword_arguments`] ["," "**" `expression`]

giving the impression that `*expression` is allowed twice.

--
nosy: +mjpieters

___
Python tracker 

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



[issue22043] Use a monotonic clock to compute timeouts

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

To have an even smaller patch, I created the issue #22287 just to add the 
dependency to the librt module in pytime.c.

--

___
Python tracker 

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



[issue22286] Allow backslashreplace error handler to be used on input

2014-08-27 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue22288] Incorrect Call grammar in documentation

2014-08-27 Thread Martijn Pieters

New submission from Martijn Pieters:

The changes for issue #3473 introduced a documentation bug. The Call expression 
grammar implies that f(*[1, 2], *[3, 4]) is allowed:

| "*" `expression` ["," "*" `expression`] ["," "**" `expression`]

I think Benjamin meant to use:

| "*" `expression` ["," `keyword_arguments `] ["," "**" `expression`]

instead, see the corresponding commit for Python 3.x: 
http://hg.python.org/cpython/diff/6abada05c313/Doc/reference/expressions.rst

--
assignee: docs@python
components: Documentation
messages: 225970
nosy: docs@python, mjpieters
priority: normal
severity: normal
status: open
title: Incorrect Call grammar in documentation
versions: Python 2.7

___
Python tracker 

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



[issue22042] signal.set_wakeup_fd(fd): raise an exception if the fd is in blocking mode

2014-08-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d984dfe8c34e by Victor Stinner in branch 'default':
Issue #22042: signal.set_wakeup_fd(fd) now raises an exception if the file
http://hg.python.org/cpython/rev/d984dfe8c34e

--

___
Python tracker 

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



[issue22042] signal.set_wakeup_fd(fd): raise an exception if the fd is in blocking mode

2014-08-27 Thread STINNER Victor

Changes by STINNER Victor :


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

___
Python tracker 

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



[issue18814] Add tools for "cleaning" surrogate escaped strings

2014-08-27 Thread Nick Coghlan

Nick Coghlan added the comment:

Note that pairing fsencode with 'utf-8' isn't guaranteed to do the right thing. 
It would work for the default C locale (since that's ASCII), but not in the 
general case.

Enhancing backslashreplace to also work on input is an interesting idea, but 
worth making it's own RFE: http://bugs.python.org/issue22286

I also agree we can ignore xmlcharrefreplace here.

So that leaves the basic pattern as:

data.encode('utf-8', 'surrogateescape').decode('utf-8', 'replace')
data.encode('utf-8', 'surrogateescape').decode('utf-8', 'ignore')
data.encode('utf-8', 'surrogateescape').decode('utf-8', 'backslashreplace')

This wouldn't allow the option of substituting an ASCII question mark, but I'd 
be OK with that.

Possible function name and implementation:

def convert_surrogateescape(data, errors='replace'):
return data.encode('utf-8', 'surrogateescape').decode('utf-8', errors)

Added bonus: pass "errors='strict'" and you'll get an exception if there were 
any surrogate escaped values in the string. (I take that emergent property as a 
sign that we're converging on a sensible design here)

Adding a fast path for keeping track of whether or not a string contains 
escaped surrogates would then be a separate RFE.

--
dependencies: +Allow backslashreplace error handler to be used on input

___
Python tracker 

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



[issue21998] asyncio: a new self-pipe should be created in the child process after fork

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

A first step would be to document the issue in the "developer" section of 
asyncio documentation. Mention that the event loop should be closed and a new 
event loop should be created.

--

___
Python tracker 

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



[issue22272] sqlite3 memory leaks in cursor.execute

2014-08-27 Thread STINNER Victor

Changes by STINNER Victor :


--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue22285] The Modules/ directory should not be added to sys.path

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

> I'd like to preserve support for building dynamic extension modules through 
> Modules/Setup, but they don't have to live in Modules; putting them into 
> build (say) would be fine as well.

Does it mean that you are ok to commit my patch?

--

___
Python tracker 

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



[issue22285] The Modules/ directory should not be added to sys.path

2014-08-27 Thread Stefan Krah

Stefan Krah added the comment:

I think we have this behavior since 6c468df214dc and 227ce85bdbe0 (#17095).

--
nosy: +ned.deily, twouters

___
Python tracker 

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



[issue22090] Decimal and float formatting treat '%' differently for infinities and nans.

2014-08-27 Thread Stefan Krah

Stefan Krah added the comment:

The revisions that cause the bot to go red (6c468df214dc and 227ce85bdbe0) are
quite recent, so I suggest we address the failure in #22285.

--

___
Python tracker 

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



[issue22042] signal.set_wakeup_fd(fd): raise an exception if the fd is in blocking mode

2014-08-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f5f5553f219e by Victor Stinner in branch 'default':
Issue #22042: Fix test_signal on Windows
http://hg.python.org/cpython/rev/f5f5553f219e

--

___
Python tracker 

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



[issue17095] Modules/Setup *shared* support broken

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

I reopen the issue because these changes broke the decimal module when the 
_decimal module is missing: see the issue #22285.

Martin von Loewis proposed to build modules in the build directory, not in the 
Modules directory directly:
http://bugs.python.org/issue22285#msg225961

--
nosy: +haypo
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue17095] Modules/Setup *shared* support broken

2014-08-27 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +loewis, skrah

___
Python tracker 

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



[issue22289] support.transient_internet() doesn't catch timeout on FTP tests of test_urllib2net

2014-08-27 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch should fix the following sporadic error. I wrote the patch for 
Python 3.5. I will adapt it for Python 2.7 and 3.4 if the review is positive.

http://buildbot.python.org/all/builders/AMD64%20Ubuntu%20LTS%203.x/builds/4837/steps/test/logs/stdio

==
ERROR: test_ftp_basic (test.test_urllib2net.TimeoutTest)
--
Traceback (most recent call last):
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 1388, 
in ftp_open
fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 1410, 
in connect_ftp
persistent=False)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 2232, 
in __init__
self.init()
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 2238, 
in init
self.ftp.connect(self.host, self.port, self.timeout)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/ftplib.py", line 153, in connect
source_address=self.source_address)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/socket.py", line 655, in 
create_connection
raise err
  File "/opt/python/3.x.langa-ubuntu/build/Lib/socket.py", line 646, in 
create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_urllib2net.py", line 
308, in test_ftp_basic
u = _urlopen_with_retry(self.FTP_HOST)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_urllib2net.py", line 
33, in wrapped
return _retry_thrice(func, exc, *args, **kwargs)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_urllib2net.py", line 
29, in _retry_thrice
raise last_exc
  File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_urllib2net.py", line 
23, in _retry_thrice
return func(*args, **kwargs)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 153, in 
urlopen
return opener.open(url, data, timeout)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 455, in 
open
response = self._open(req, data)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 473, in 
_open
'_open', req)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 433, in 
_call_chain
result = func(*args)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 1406, 
in ftp_open
raise exc.with_traceback(sys.exc_info()[2])
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 1388, 
in ftp_open
fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 1410, 
in connect_ftp
persistent=False)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 2232, 
in __init__
self.init()
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 2238, 
in init
self.ftp.connect(self.host, self.port, self.timeout)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/ftplib.py", line 153, in connect
source_address=self.source_address)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/socket.py", line 655, in 
create_connection
raise err
  File "/opt/python/3.x.langa-ubuntu/build/Lib/socket.py", line 646, in 
create_connection
sock.connect(sa)
urllib.error.URLError: 

--
components: Tests
files: transient_internet_ftp_timeout.patch
keywords: patch
messages: 225979
nosy: haypo
priority: normal
severity: normal
status: open
title: support.transient_internet() doesn't catch timeout on FTP tests of 
test_urllib2net
versions: Python 2.7, Python 3.4, Python 3.5
Added file: 
http://bugs.python.org/file36486/transient_internet_ftp_timeout.patch

___
Python tracker 

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



[issue22288] Incorrect Call grammar in documentation

2014-08-27 Thread Martijn Pieters

Martijn Pieters added the comment:

Proposed fix added in my fork.

--
hgrepos: +270

___
Python tracker 

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



[issue22288] Incorrect Call grammar in documentation

2014-08-27 Thread Martijn Pieters

Changes by Martijn Pieters :


--
keywords: +patch
Added file: http://bugs.python.org/file36487/ffe77dc2979a.diff

___
Python tracker 

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



[issue22288] Incorrect Call grammar in documentation

2014-08-27 Thread Martijn Pieters

Changes by Martijn Pieters :


Removed file: http://bugs.python.org/file36487/ffe77dc2979a.diff

___
Python tracker 

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



[issue22288] Incorrect Call grammar in documentation

2014-08-27 Thread Martijn Pieters

Martijn Pieters added the comment:

Sigh, patch creation fails against a remove repository; I guess this only works 
for the default branch.

Attached as a patch file instead.

--
Added file: http://bugs.python.org/file36488/issue22288.patch

___
Python tracker 

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



[issue22288] Incorrect Call grammar in documentation

2014-08-27 Thread Martijn Pieters

Changes by Martijn Pieters :


--
hgrepos:  -270

___
Python tracker 

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



[issue22285] The Modules/ directory should not be added to sys.path

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

Another bug linked to the bad Modules/_ctypes package:
http://buildbot.python.org/all/builders/AMD64%20OpenIndiana%203.x/builds/8549/steps/test/logs/stdio

test test_ctypes crashed -- Traceback (most recent call last):
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/regrtest.py",
 line 1271, in runtest_inner
the_module = importlib.import_module(abstest)
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/importlib/__init__.py",
 line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 2203, in _gcd_import
  File "", line 2186, in _find_and_load
  File "", line 2175, in _find_and_load_unlocked
  File "", line 1149, in _load_unlocked
  File "", line 1420, in exec_module
  File "", line 321, in _call_with_frames_removed
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_ctypes.py",
 line 3, in 
from ctypes.test import load_tests
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/ctypes/__init__.py",
 line 7, in 
from _ctypes import Union, Structure, Array
ImportError: cannot import name 'Union'

--

___
Python tracker 

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



[issue22282] ipaddress module accepts octal formatted IPv4 addresses in IPv6 addresses

2014-08-27 Thread Fabian

Fabian added the comment:

The patch adds an optional keyword which only accepts decimal numbers.

--
keywords: +patch
Added file: http://bugs.python.org/file36489/ipaddr.patch

___
Python tracker 

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



[issue22290] "AMD64 OpenIndiana 3.x" buildbot: assertion failed in PyObject_Call() in test_subprocess.test_preexec()

2014-08-27 Thread STINNER Victor

New submission from STINNER Victor:

I ran test_subprocess.test_preexec() 2000 times: I'm unable to reproduce the 
issue on my OpenIndiana VM, nor on Linux. I used this command:
gdb -args ./python -m test -F -m test_preexec test_subprocess 

The command on the buildbot is:
./python  ./Tools/scripts/run_tests.py -j 1 -u all -W --timeout=3600 -j4

http://buildbot.python.org/all/builders/AMD64%20OpenIndiana%203.x/builds/8549/steps/test/logs/stdio

[302/390/1] test_subprocess
Assertion failed: (result != NULL && !PyErr_Occurred()) || (result == NULL && 
PyErr_Occurred()), file Objects/abstract.c, line 2091
Fatal Python error: Aborted

Current thread 0x0001 (most recent call first):
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/subprocess.py", 
line 1396 in _execute_child
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/subprocess.py", 
line 865 in __init__
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_subprocess.py",
 line 1303 in test_preexec
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/case.py",
 line 577 in run
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/case.py",
 line 625 in __call__
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/suite.py",
 line 125 in run
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/suite.py",
 line 87 in __call__
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/suite.py",
 line 125 in run
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/suite.py",
 line 87 in __call__
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/unittest/runner.py",
 line 168 in run
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/support/__init__.py",
 line 1750 in _run_suite
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/support/__init__.py",
 line 1784 in run_unittest
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_subprocess.py",
 line 2470 in test_main
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/regrtest.py",
 line 1280 in runtest_inner
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/regrtest.py",
 line 967 in runtest
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/regrtest.py",
 line 532 in main
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/regrtest.py",
 line 1564 in main_in_temp_cwd
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/regrtest.py",
 line 1589 in 
  File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/runpy.py", 
line 85 in _run_code
  File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/runpy.py", 
line 170 in _run_module_as_main

--
messages: 225984
nosy: haypo
priority: normal
severity: normal
status: open
title: "AMD64 OpenIndiana 3.x" buildbot: assertion failed in PyObject_Call() in 
test_subprocess.test_preexec()

___
Python tracker 

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



[issue22290] "AMD64 OpenIndiana 3.x" buildbot: assertion failed in PyObject_Call() in test_subprocess.test_preexec()

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

The error may be close to the call to the gc module: gc.isenabled(), 
gc.disable() or gc.enable(). The error is maybe an exception raised before the 
call to PyObject_Call(), because the called gc functions are very simple.

--

___
Python tracker 

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



[issue22277] webbrowser.py add parameters to suppress output on stdout and stderr

2014-08-27 Thread R. David Murray

R. David Murray added the comment:

I think it is up to you motivate the reason why the new stdin and stderr 
parameters should have *different* semantics from the same parameters used with 
subprocess.  Consistency is good, unless there is a specific reason to break 
consistency.  That is, if the semantics are the same, a programmer can see 
stdin/stderr and know they work exactly like the equivalent subprocess args, 
instead of assuming they do and then getting bitten by the difference.

Unless there is some reason I'm not seeing why the difference in semantics is 
needed.

--

___
Python tracker 

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



[issue22090] Decimal and float formatting treat '%' differently for infinities and nans.

2014-08-27 Thread R. David Murray

R. David Murray added the comment:

I'm not going to argue this any further, but "recent" is exactly the point...if 
all of the bots had turned red you'd understand that it needed to be fixed 
*immediately* or the triggering change (regardless of what the actual bug was) 
backed out.  Since it isn't all the bots it isn't that critical, but eventually 
we want to make it critical (ie: someday it will be a requirement that *all* 
stable bots pass before a change gets *committed*...but that day is still a 
longer way off than I'd like, since I at least don't have much time for working 
on the workflow stuff).

--

___
Python tracker 

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



[issue22277] webbrowser.py add parameters to suppress output on stdout and stderr

2014-08-27 Thread Cristian Consonni

Cristian Consonni added the comment:

Hi David,

*now* I understand your point (!) and, yes, this is something I have thought 
about.

Basically, I was thinking that with this addition I wanted an easy way to 
suppress stdout/stderr output. I have thought about simply exposing 
subprocess.Popen's stderr and stdout parameters (i.e. passing stdout and stdout 
to subprocess.Popen as they are) but this would have meant that to suppress the 
output one should do the following:

```
import webbrowser
import subprocess

webbrowser.open('http://www.example.com', stdout=subprocess.DEVNULL, 
stderr=subprocess.DEVNULL)
```

This seems to be utterly complicated to me, also I don't like to have to import 
the subprocess module just to make use of subprocess.DEVNULL. (an alternative 
would be passing file(os.devnull, "r+") à la Python 2.7, but the problem of 
needing an additional module remains). 
Also, I find that *in the context of the webbrowser module* using 
subprocess.Popen semantics i.e.:
```
webbrowser.open('http://www.example.com', stdout=None, stderr=None)
```
to mean that the stderr and stdout file descriptors are inherited from the 
parent process is quite counter-intuitive.

That's why I have changed the semantics of the parameters the way I did.

A couple of possible alternatives were changing the name of the parameters:
1) suppress_stdout/suppress_stderr. In this case True (which is not a valid 
value for subprocess.Popen parameters) would suppress stdout/stderr and None 
would be meaningful to say 'inherit from parent process'. In this way this 
would be an addition to subprocess.Popen semantic, but it would be 
counter-intuitive to the possibility of redirecting to, say, another file.
2) redirect_stdout/redirect_stderr. Actually this was my first thinking when 
implementing this, but it has the same problems, IMHO, of the plain 
stdout/stderr and in the end this is why I chose the latter.

Does this make sense?

Cristian

--

___
Python tracker 

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



[issue22277] webbrowser.py add parameters to suppress output on stdout and stderr

2014-08-27 Thread Cristian Consonni

Cristian Consonni added the comment:

After re-reading myself a couple of times I have to say that following 
subprocess.Popen and adding True and False with the meaning:
* True -> subprocess inherits file descriptors from the parent process 
(equivalent to None)
* False -> /dev/null
seems to be a better idea.

Consistency is a good thing is a good thing is a good thing.

Cristian

--
Added file: http://bugs.python.org/file36490/webbrowser.py.patch.3

___
Python tracker 

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



[issue22291] Typo in docs - Lib/random

2014-08-27 Thread Ben Rodrigue

New submission from Ben Rodrigue:

Small typo: 

In the documentation for the random module. The documentation refers to the 
semi-open range and then gives an example using a left bracket and then a 
curved parenthesis on the right. 

Link to page:https://docs.python.org/3.4/library/random.html

>From text:"which generates a random float uniformly in the semi-open range 
>[0.0, 1.0)"  

I am new to programming but I believe this to be incorrect. If there is a way 
to submit a patch for the documentation, I am happy to do so.

--
assignee: docs@python
components: Documentation
messages: 225990
nosy: benrodrigue, docs@python, eric.araujo, ezio.melotti, georg.brandl
priority: normal
severity: normal
status: open
title: Typo in docs - Lib/random
versions: Python 3.4

___
Python tracker 

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



[issue22277] webbrowser.py add parameters to suppress output on stdout and stderr

2014-08-27 Thread R. David Murray

R. David Murray added the comment:

It makes sense, but I'm not sure avoiding the extra import is sufficient 
motivation.  If you weren't allowing redirection it would be a different story, 
but allowing redirection seems logical.

We should get the opinion of some other developers.  I've added some people to 
nosy who have worked on subprocess and/or webbrowser in the not too distant 
past.

Note: a third option is to import DEVNULL into the webbrowser namespace.  That 
kind of redundancy feels suspect, but practicality might beat purity here.

--
nosy: +georg.brandl, gps, pitrou

___
Python tracker 

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



[issue22285] The Modules/ directory should not be added to sys.path

2014-08-27 Thread Martin v . Löwis

Martin v. Löwis added the comment:

> Does it mean that you are ok to commit my patch?

No, because it will break #17095 again. A proper patch would do what you do, 
plus find some other solution to #17095. Just reverting 6c468df214dc is not ok.

--

___
Python tracker 

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



[issue22090] Decimal and float formatting treat '%' differently for infinities and nans.

2014-08-27 Thread Stefan Krah

Stefan Krah added the comment:

> I'm not going to argue this any further, but "recent" is exactly the 
> point...if all of the bots had turned red you'd understand that it needed to 
> be fixed *immediately* or the triggering change (regardless of what the 
> actual bug was) backed out.  Since it isn't all the bots it isn't that 
> critical, but eventually we want to make it critical (ie: someday it will be 
> a requirement that *all* stable bots pass before a change gets 
> *committed*...but that day is still a longer way off than I'd like, since I 
> at least don't have much time for working on the workflow stuff).

How is this supposed to work though?  In this case 6c468df214dc and 227ce85bdbe0
need to be backed out, since they apparently also broke the OpenIndiana bot long
ago (why wasn't that discovered?).

However, I don't feel that it is my place to back them out, since I did not
commit them and might step on other people's toes.

I don't think that the burden of having green buildbots should be on the
person who commits something that *exposes* existing issues (unless, as
you say, *all* buildbots turn red).

--

___
Python tracker 

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



[issue22291] Typo in docs - Lib/random

2014-08-27 Thread R. David Murray

R. David Murray added the comment:

That's mathematical notation, not python syntax.  Note that in the html it is 
*not* styled as a literal code snippet.

--
nosy: +r.david.murray
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue22059] incorrect type conversion from str to bytes in asynchat module in asynchat.py

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

Since Hoxily didn't reply the question, I suggest to close this issue as "not a 
bug" since we don't have enough information to understand it.

--

___
Python tracker 

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



[issue4277] asynchat's handle_error inconsistency

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

This issue is 6 years old. I don't understand the bug and the patch has no unit 
test. I suggest to close the issue as out of date. The asynchat module is now 
deprecated in favor of the new shiny asyncio module.

--
nosy: +haypo

___
Python tracker 

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



[issue22090] Decimal and float formatting treat '%' differently for infinities and nans.

2014-08-27 Thread R. David Murray

R. David Murray added the comment:

Yeah, right now that's fine.  We'll work out the more strict process if/when we 
start actually enforcing it :)

--

___
Python tracker 

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



[issue22059] incorrect type conversion from str to bytes in asynchat module in asynchat.py

2014-08-27 Thread R. David Murray

R. David Murray added the comment:

Since it is effectively a deprecated module, let's do that.

--
resolution:  -> works for me
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue11267] asyncore does not check for POLLERR and POLLHUP if neither readable nor writable

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

> Why descriptor does not get polled if neither read nor write selected ?

IMO it's a deliberate design choice, made for performances.

In the asyncio module, the high-level StreamReader API stops listening to read 
even if the buffer is too large (if we received more than limit*2 bytes, where 
limit is 64 KB by default). We listen again when the application reads enough 
data from the buffer.

When we stop listening to read event (and we don't listen to write events 
neither), we ignore completly the socket. So if the socket is closed, we are 
not notified immediatly. IMO it's a design choice for efficency. It's more 
efficient to ignore temporarily the socket while the application is busy, than 
notifying immediatly that the connection was closed.

In my test, I still got some bytes with socket.recv() even after the connection 
was already closed by the peer.

Pseudo-code:

- client: connect
- client: recv(10): get some bytes
- server: close the connection
- client: recv(10): get more bytes (even if the connection was already closed)
- client: notified that the connection was closed

I don't think that asyncore nor asyncio should be modified to be notified 
immediatly that a connection was closed, so I close the issue.

Thanks for your report, it was an interesting question :-)

--
nosy: +haypo
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue6550] asyncore incorrect failure when connection is refused and using async_chat channel

2014-08-27 Thread STINNER Victor

STINNER Victor added the comment:

The latest patch was written 5 years ago, it's probably a huge work to rebase 
it. Giampaolo wrote that the code changed a lot since this time (especially 
code handling errors).

asyncore-fix-refused-4.patch catchs EBADF. To me, it looks like a bug: if you 
get a EBADF error, we already made something wrong before.

The patch doesn't call obj.handle_expt_event() anymore in _exception() if obj 
is not a socket. It don't understand why. I don't understand neither why 
_exception() now raises a new socket error instead of calling 
obj.handle_expt_event().

All these changes are non trivial. I don't feel able to review the patch.

Sorry, I'm not interested to invest time on this deprecated module. It's time 
to move forward, to asyncio, and so I close this issue.

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

___
Python tracker 

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



[issue22279] read() vs read1() in asyncio.StreamReader documentation

2014-08-27 Thread Guido van Rossum

Guido van Rossum added the comment:

Loet's just spruce up the docs a bit.  (Also maybe fix that awkward sentence in 
the BufferedReader docs.)

--

___
Python tracker 

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



[issue22279] read() vs read1() in asyncio.StreamReader documentation

2014-08-27 Thread Jack O'Connor

Jack O'Connor added the comment:

Agreed that changing read() would probably break tons of people. I don't think 
a naming inconsistency meets the "serious flaws are uncovered" bar for breaking 
a provisional package. If we actually prefer the asyncio way of doing things, 
all the better.

That said, another thing I'm noticing is that in asyncio, read is basically two 
different functions. This is clear in the code, 
http://hg.python.org/cpython/file/fb3aee1cff59/Lib/asyncio/streams.py#l433, 
where the n<0 case goes off on its own branch and never comes back. 
(Incidentally there's another n<0 check at line 453 there that I think always 
returns false.) We have a read function that makes very different guarantees 
depending on the value of n. Contrast this with the read function from regular 
io, where read(n) and read() are effectively the same if n is large enough. 
Maybe just another point that's worth clarifying in the docs.

Thanks for the quick replies!

--

___
Python tracker 

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



[issue22279] read() vs read1() in asyncio.StreamReader documentation

2014-08-27 Thread Guido van Rossum

Guido van Rossum added the comment:

Yeah, that too should just be documented. The read-until-eof behavior is
quite entrenched (in fact I had a hard time finding example read calls with
a size parameter :-). Specifying a huge buffer size in order to read until
EOF isn't really a common practice, but definitely worth pointing out in
the docs.

On Wed, Aug 27, 2014 at 10:22 AM, Jack O'Connor 
wrote:

>
> Jack O'Connor added the comment:
>
> Agreed that changing read() would probably break tons of people. I don't
> think a naming inconsistency meets the "serious flaws are uncovered" bar
> for breaking a provisional package. If we actually prefer the asyncio way
> of doing things, all the better.
>
> That said, another thing I'm noticing is that in asyncio, read is
> basically two different functions. This is clear in the code,
> http://hg.python.org/cpython/file/fb3aee1cff59/Lib/asyncio/streams.py#l433,
> where the n<0 case goes off on its own branch and never comes back.
> (Incidentally there's another n<0 check at line 453 there that I think
> always returns false.) We have a read function that makes very different
> guarantees depending on the value of n. Contrast this with the read
> function from regular io, where read(n) and read() are effectively the same
> if n is large enough. Maybe just another point that's worth clarifying in
> the docs.
>
> Thanks for the quick replies!
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue22269] Resolve distutils option conflicts with priorities

2014-08-27 Thread Min RK

Min RK added the comment:

`--prefix` vs `--user` is the only conflict I have encountered, but based on 
the way it works, it could just as easily happen with any of the various other 
conflicting options in install (install_base, exec_prefix, etc.), though that 
might not be very common.

There is a general question: If a Python distributor wants sys.prefix and 
default install_prefix to differ, what's the right way to do it? Setting it in 
distutils.cfg makes sense other than the conflicting option issues. Could there 
be a special `default_prefix` key that gets used as the final fallback (end of 
install.finalize_unix)?

I would really like to avoid having a warning on every install, since warning 
suggests that something has been done incorrectly, which in turn suggests that 
`distutils.cfg` is the wrong place to set the install prefix.

--

___
Python tracker 

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



[issue22292] pickle whichmodule RuntimeError

2014-08-27 Thread attilio.dinisio

New submission from attilio.dinisio:

= Error message =
pickle.dumps and pickle.dump generate the following error:

  File "/usr/lib/python3.4/pickle.py", line 283, in whichmodule
for module_name, module in sys.modules.items():
RuntimeError: dictionary changed size during iteration


= Test case = 
The test case is as follows:

import pickle
import sys
import numpy #version 1.8.1
import scipy.signal #version 0.13.3
pickle.dumps(numpy.cos)

Sometimes this results in the error

Traceback (most recent call last):
  File "whichmodule_bug.py", line 13, in 
pickle.dumps(numpy.cos)
  File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 61, in 
_ufunc_reduce
return _ufunc_reconstruct, (whichmodule(func, name), name)
  File "/usr/lib/python3.4/pickle.py", line 283, in whichmodule
for module_name, module in sys.modules.items():
RuntimeError: dictionary changed size during iteration

NOTE: This is not necessarily a problem due to numpy and scipy packages. 
Explanation follows.


= Relevant code = 
The last version of pickle 
http://hg.python.org/cpython/file/f6f691ff27b9/Lib/pickle.py contains:
...

def _getattribute(obj, name, allow_qualname=False):
dotted_path = name.split(".")
if not allow_qualname and len(dotted_path) > 1:
raise AttributeError("Can't get qualified attribute {!r} on {!r}; " +
 "use protocols >= 4 to enable support"
 .format(name, obj))
for subpath in dotted_path:
if subpath == '':
raise AttributeError("Can't get local attribute {!r} on {!r}"
 .format(name, obj))
try:
obj = getattr(obj, subpath)
except AttributeError:
raise AttributeError("Can't get attribute {!r} on {!r}"
 .format(name, obj))
return obj

def whichmodule(obj, name, allow_qualname=False):
"""Find the module an object belong to."""
module_name = getattr(obj, '__module__', None)
if module_name is not None:
return module_name
for module_name, module in sys.modules.items():
if module_name == '__main__' or module is None:
continue
try:
if _getattribute(module, name, allow_qualname) is obj:
return module_name
except AttributeError:
pass
return '__main__'
...

= History =
The iteration 

 for module_name, module in sys.modules.items():

in pickle.py was changed in 2007 to

 for name, module in list(sys.modules.items()):

by the BDFL [http://hg.python.org/cpython/rev/0d2dc3611e3b?revcount=800] to 
"Fix a bizarre error...", then it was reverted by 
[http://hg.python.org/cpython/rev/992ef855b3ed] in 2013. I hope the BDFL never 
discover this :-)


= Explanation = 
It seems that while iterating in sys.modules, getattr is called on an instance 
of scipy.lib.six.MovedModule, which triggers a change in sys.modules (due to an 
import). This result in the RuntimeError: dictionary changed size during 
iteration.
Freezing the list, with list(sys.modules.items()) resolves this particular 
issue.


= Notes on reproducing this error =
Reproducing my test case might be difficult for the following reason.
I installed scipy version 0.13.3 on Kubuntu 14.04 (sudo apt-get install 
python3-scipy). In the online  source code, module six.py version 1.2.0 is 
included [https://github.com/scipy/scipy/releases/tag/v0.13.3]. However in my 
system the module six.py that is actually used is 1.5.2, which probably has 
been installed independently from scipy. 
Finally, the new version of scipy, 0.14.0, doesn't use the class 
scipy.lib.six.MovedModule which triggers this error. Unfortunately this new 
version isn't available in Ubuntu 14.04.

--
components: Library (Lib)
messages: 226005
nosy: attilio.dinisio, pitrou
priority: normal
severity: normal
status: open
title: pickle whichmodule RuntimeError
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue3332] DocTest and dict sort.

2014-08-27 Thread endolith

endolith added the comment:

I ran into this bug with sets, too.  

Expected:
{6, 5, 3}
Got:
set([5, 3, 6])

Documentation should illustrate how the function is actually meant to be used, 
not contrived examples that convert to sorted output purely so that doctest can 
understand them.  doctest should be changed (or have an option) to understand 
object equality rather than exact text output.

--
nosy: +endolith

___
Python tracker 

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



[issue22266] fix reliance on refcounting in tarfile.gzopen

2014-08-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6f0dae921bee by Benjamin Peterson in branch '2.7':
properly handle file closing in error cases (closes #22266)
http://hg.python.org/cpython/rev/6f0dae921bee

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

___
Python tracker 

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



[issue16662] load_tests not invoked in package/__init__.py

2014-08-27 Thread Robert Collins

Robert Collins added the comment:

The doc part of the patch was assuming this would be in 3.4 which it wasn't. 
Updated to 3.5. Also found a corner case - when packages were imported the 
_get_module_from_name method was not guarded for un-importable modules. This is 
strictly a separate issue, but since we'll now import considerably more 
modules, it seemed prudent to fix it at the same time.

--
Added file: http://bugs.python.org/file36491/16662_passing_tests_full.diff

___
Python tracker 

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



[issue21611] int() docstring - unclear what number is

2014-08-27 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue3473] In function call, keyword arguments could follow *args

2014-08-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3ae399c6ecf6 by Benjamin Peterson in branch '2.7':
correct call grammar error (#3473)
http://hg.python.org/cpython/rev/3ae399c6ecf6

--
nosy: +python-dev

___
Python tracker 

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



[issue3332] DocTest and dict sort.

2014-08-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> doctest should be changed (or have an option) to understand 
> object equality rather than exact text output.

Sorry, but that would be at odds with the fundamental design of doctest which 
is principally designed to test documentation in the form of docstrings (which, 
it goes without saying actually *are* strings).

Try using another tool for the job.  The unittest module is well suited for 
tests that need to understand object equality.

--

___
Python tracker 

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



[issue22231] httplib: unicode url will cause an ascii codec error when combined with a utf-8 string header

2014-08-27 Thread Bob Chen

Changes by Bob Chen <175818...@qq.com>:


--
keywords: +patch
Added file: http://bugs.python.org/file36492/httplib.py.patch

___
Python tracker 

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



[issue22231] httplib: unicode url will cause an ascii codec error when combined with a utf-8 string header

2014-08-27 Thread Bob Chen

Bob Chen added the comment:

This patch ensures the url not to be unicode, so the 'join' would not cause 
error when there is utf-8 string behind.

--

___
Python tracker 

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