[issue21118] str.translate is absurdly slow in majority of use cases (takes up to 60x longer than similar functions)

2014-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cb632988bc09 by Victor Stinner in branch 'default':
Issue #21118: PyLong_AS_LONG() result type is long
http://hg.python.org/cpython/rev/cb632988bc09

--

___
Python tracker 

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



[issue21175] Refcounting error in str.translate fastpath

2014-04-08 Thread STINNER Victor

STINNER Victor added the comment:

> New changeset fa6debebfe8b by Benjamin Peterson in branch 'default':
> fix reference leaks in the translate fast path (closes #21175)
> http://hg.python.org/cpython/rev/fa6debebfe8b

Thanks Benjamin for the quick fix!

--

___
Python tracker 

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



[issue19746] No introspective way to detect ModuleImportFailure in unittest

2014-04-08 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



[issue21177] ValueError: byte must be in range(0, 256)

2014-04-08 Thread Konstantin Zemlyak

New submission from Konstantin Zemlyak:

Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> bytearray([256])
Traceback (most recent call last):
  File "", line 1, in 
ValueError: byte must be in range(0, 256)
>>> bytes([256])
Traceback (most recent call last):
  File "", line 1, in 
ValueError: bytes must be in range(0, 256)
>>> 


Tested on 2.7, 3.2, 3.3, 3.4. Frankly, this looks like an off-by-one error to 
me.

--
components: Interpreter Core
messages: 215744
nosy: zart
priority: normal
severity: normal
status: open
title: ValueError: byte must be in range(0, 256)
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue21177] ValueError: byte must be in range(0, 256)

2014-04-08 Thread STINNER Victor

STINNER Victor added the comment:

256 is not part of the range(0, 256): 0..255.

$ python
>>> print(list(range(0,256)))
[0, 1, 2, 3, ..., 253, 254, 255]

It doesn't make sense to store the number 256 in a byte string.

--
nosy: +haypo

___
Python tracker 

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



[issue21041] pathlib.PurePath.parents rejects negative indexes

2014-04-08 Thread akira

akira added the comment:

>From https://docs.python.org/3/glossary.html#term-sequence

> An iterable which supports efficient element access using integer indices via 
> the __getitem__() special method and defines a __len__() method that returns 
> the length of the sequence.

.parents *is* a sequence. And it *is* confusing that it doesn't accept negative 
indexes -- that is how I've encountered the bug.

Antoine, could you elaborate on what are the negative consequences of negative 
indexes to justify breaking the expectations?

--

___
Python tracker 

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



[issue21177] ValueError: byte must be in range(0, 256)

2014-04-08 Thread Stefan Krah

Stefan Krah added the comment:

I think it's possible to misunderstand this error message if the
reader does not realize that range(0, 256) is to be taken literally.

Perhaps we should just use closed intervals of the form [0, 255]
everywhere.

--
nosy: +skrah

___
Python tracker 

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



[issue21177] ValueError: byte must be in range(0, 256)

2014-04-08 Thread STINNER Victor

STINNER Victor added the comment:

"Perhaps we should just use closed intervals of the form [0, 255] everywhere."

I only saw range(0, 256) in Python. At school, I used [0, 255]. I prefer [0, 
255] syntax, it's more explicit :-)

--

___
Python tracker 

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



[issue21177] ValueError: byte must be in range(0, 256)

2014-04-08 Thread Peter Otten

Peter Otten added the comment:

As every beginner will learn about (and probably overuse) range() pretty soon I 
think it's OK to use that form. 

The math-inspired notation [0, 255] may be misinterpreted as a list. You also 
lose the consistency of preferring half-open intervals everywhere.

The third alternative I see,

0 <= x < 256

has the problem that it requires a name (the 'x') that may not correspond to a 
variable in the source code. You'd also need to clarify that x must be an int 
to make the message bulletproof.

I think this should be left as is.

--
nosy: +peter.otten

___
Python tracker 

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



[issue21178] doctest cause warnings in tests using generators

2014-04-08 Thread Ontje Lünsdorf

New submission from Ontje Lünsdorf:

The attached doctest raises a warning since Python 3.4:

$ python -m doctest doctest.txt
Exception ignored in: 
Traceback (most recent call last):
  File "", line 4, in foo
NameError: name 'socket' is not defined

My guess is that doctest cleans up globals() of the test snippet (thereby 
deleting socket). Afterwards python cleans up the generator by sending in a 
GeneratorExit exception. The except block will now fail because socket is not 
available anymore.

--
components: Tests
files: doctest.txt
messages: 215750
nosy: oluensdorf
priority: normal
severity: normal
status: open
title: doctest cause warnings in tests using generators
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file34760/doctest.txt

___
Python tracker 

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



[issue21177] ValueError: byte must be in range(0, 256)

2014-04-08 Thread STINNER Victor

STINNER Victor added the comment:

> The math-inspired notation [0, 255] may be misinterpreted as a list. You also 
> lose the consistency of preferring half-open intervals everywhere.

Not if you write "x must in the range [0; 255]".

--

___
Python tracker 

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



[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-08 Thread Vinay Sajip

Vinay Sajip added the comment:

I wouldn't say it is a bug, as it is working as documented - though you might 
say it is a request for enhancement. The documentation for string formatting at

https://docs.python.org/2/library/stdtypes.html#string-formatting-operations

says that the argument should be a "single mapping object", and, further down 
the same page at

https://docs.python.org/2/library/stdtypes.html#mapping-types-dict

it's clear that the mapping protocol is more than just __getitem__. Although 
perhaps currently only __getitem__ is used, who's to say that such will always 
remain the case?

Removing Python versions 3.2, 3.3 (security fixes only).

--
versions:  -Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-08 Thread Vinay Sajip

Changes by Vinay Sajip :


--
type: behavior -> enhancement

___
Python tracker 

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



[issue21179] Rounding half to even

2014-04-08 Thread Clinton Curry

New submission from Clinton Curry:

In the current Python 2.7 documentation, Section 5.4

https://docs.python.org/2.7/library/stdtypes.html

the result of the round function is described as "x rounded to n digits, 
rounding half to even. If n is omitted, it defaults to 0."  However, my 
observed behavior (Python 2.7.4 (default, Apr  6 2013, 19:55:15) [MSC v.1500 64 
bit (AMD64)] on win32) does not round half to even, but rounds half away from 
zero.

>>> round(1.5)
2.0
>>> round(2.5)
3.0
>>> round(-1.5)
-2.0
>>> round(-2.5)
-3.0

I observe similar behavior on other platforms.

--
assignee: docs@python
components: Documentation
messages: 215753
nosy: Clinton.Curry, docs@python, eric.araujo, ezio.melotti, georg.brandl
priority: normal
severity: normal
status: open
title: Rounding half to even
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



[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-08 Thread Vinay Sajip

Vinay Sajip added the comment:

Looking into it further, I see no incidence in logging code of the string 
"format requires a mapping" or of raising a TypeError with such a message. Can 
you provide more information? Otherwise I will have to close this issue as 
invalid.

--
resolution:  -> invalid
status: open -> pending

___
Python tracker 

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



[issue21178] doctest cause warnings in tests using generators

2014-04-08 Thread Ontje Lünsdorf

Ontje Lünsdorf added the comment:

Sorry, the test does not really expose the problem with Python 3.4. Here is an 
updated example.

Python 2.7 and 3.3 succeed without warnings, while Python 3.4 warns about an 
ignored exception.

--
Added file: http://bugs.python.org/file34761/doctest.txt

___
Python tracker 

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



[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-08 Thread Alan Briolat

Alan Briolat added the comment:

Because the object in question is not actually a dict, LogRecord is attempting, 
in this example, "%(bar)s" % (f,) instead of "%(bar)s" % f.

In unicodeobject.c this causes the PyMapping_Check in PyUnicode_Format to fail 
because it's a tuple (note that PyMapping_Check *only* checks for the 
__getitem__ attribute), the argument to not be treated as a dict, and 
consequently ctx.dict = NULL for the format operation.

This condition, combined with still attempting to resolve named values in the 
format string, causes unicode_format_arg_parse to raise the TypeError("format 
requires a mapping").

Speaking of documentation, the language of

https://docs.python.org/2/library/logging.html#logging.Logger.debug

strongly suggests that logging.debug(msg, args...) should be considered 
equivalent to logging.debug(msg % args...), which still means this is still 
"unexpected" behaviour.  The intention is clearly to allow this special case to 
pass through to the formatting operator unimpeded, however this doesn't happen.

Also, even if "the mapping protocol" should remain the key concept (the 
behaviour of PyMapping_Check being a happy accident), checking for 
isinstance(..., dict) is still wrong - it should at least be 
collections.Mapping to give users a chance to emulate the correct interface.

--
status: pending -> open

___
Python tracker 

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



[issue17145] memoryview(array.array)

2014-04-08 Thread Paul Sokolovsky

Changes by Paul Sokolovsky :


--
nosy: +pfalcon

___
Python tracker 

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



[issue21180] Cannot efficiently create empty array.array of given size, inconsistency with bytearray

2014-04-08 Thread Paul Sokolovsky

New submission from Paul Sokolovsky:

With bytearray, you can do:

>>> bytearray(3)
bytearray(b'\x00\x00\x00')

However, with arrays:

>>> array.array('i', 3)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'int' object is not iterable

Given that int passed as seconf argument is not handled specially in array, I'd 
like to propose to make it an initial size of a zero-filled array to create. 
This will make it: a) consitent with bytearray; b) efficient for the scenarios 
where one needs to pre-create array of given length, pass to some (native) 
function to fill in, then do rest of processing. For the latter case, assuming 
that both fill-in and further processing is efficient (e.g. done by native 
function), the initial array creation becomes a bottleneck.

--
components: Library (Lib)
messages: 215757
nosy: pfalcon
priority: normal
severity: normal
status: open
title: Cannot efficiently create empty array.array of given size, inconsistency 
with bytearray
type: performance
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



[issue9066] Standard type codes for array.array, same as struct

2014-04-08 Thread Paul Sokolovsky

Paul Sokolovsky added the comment:

> It's not clear to me that importing specifier prefixes from the struct module 
> is the best way to go about this, though.

What are other alternatives then? Using struct's syntax has obvious benefit of 
being consistent and not confusing people any further.

--
nosy: +pfalcon

___
Python tracker 

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



[issue9066] Standard type codes for array.array, same as struct

2014-04-08 Thread Paul Sokolovsky

Paul Sokolovsky added the comment:

See also http://bugs.python.org/issue17345

--

___
Python tracker 

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



[issue17345] Portable and extended type specifiers for array module

2014-04-08 Thread Paul Sokolovsky

Paul Sokolovsky added the comment:

See also http://bugs.python.org/issue9066

--
nosy: +pfalcon

___
Python tracker 

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



[issue16395] Documentation claims that PySequence_Fast returns a tuple, when it actually returns a list.

2014-04-08 Thread Larry Hastings

Larry Hastings added the comment:

I have no objections to someone backporting this.

--

___
Python tracker 

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



[issue21176] Implement matrix multiplication operator (PEP 465)

2014-04-08 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Here's what I consider a complete patch.

--
assignee: belopolsky -> benjamin.peterson
Added file: http://bugs.python.org/file34762/mat-mult5.patch

___
Python tracker 

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



[issue16395] Documentation claims that PySequence_Fast returns a tuple, when it actually returns a list.

2014-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b2187b82a658 by Benjamin Peterson in branch '3.4':
PySequence_Fast generally returns a list not a tuple (closes #16395)
http://hg.python.org/cpython/rev/b2187b82a658

New changeset b235db467cd5 by Benjamin Peterson in branch '2.7':
PySequence_Fast generally returns a list not a tuple (closes #16395)
http://hg.python.org/cpython/rev/b235db467cd5

New changeset c833c35aa13a by Benjamin Peterson in branch 'default':
merge 3.4 (#16395)
http://hg.python.org/cpython/rev/c833c35aa13a

--
nosy: +python-dev
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue16305] possible segfault in math.factorial

2014-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3016a9e8061a by Benjamin Peterson in branch '2.7':
PySequence_Fast generally returns a list (#16305)
http://hg.python.org/cpython/rev/3016a9e8061a

--

___
Python tracker 

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



[issue16305] possible segfault in math.factorial

2014-04-08 Thread Benjamin Peterson

Benjamin Peterson added the comment:

(Obviously that last message should have gone to #16395 instead.)

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue20924] openssl init 100% CPU utilization

2014-04-08 Thread Roman O. Vlasov

Roman O. Vlasov added the comment:

Antoine, Martin, thank you for your replies. You was right: NT socket was not 
in blocking mode (in 1st case). I didn't knew how to determine socket mode in 
NT, so I explicitly set socket mode to blocking in _ssl.c before calling 
SSL_do_handshake() for test:

_ssl.c::PySSL_SSLdo_handshake():

//  Explicitly set blocking mode
unsigned long iMode = 0UL; // If iMode = 0, blocking is enabled; 
int iResult = ioctlsocket( self->Socket->sock_fd, FIONBIO, &iMode );
if (iResult != NO_ERROR)
printf("\nioctlsocket failed with error: %ld\n", iResult);
// 
PySSL_BEGIN_ALLOW_THREADS
ret = SSL_do_handshake(self->ssl);
...

Test result: SSL_do_handshake() did not return (and no CPU load).

But in general, I think that check_socket_and_wait_for_timeout() logic is 
erroneous:
if (s->sock_timeout < 0.0)
return SOCKET_IS_BLOCKING;

By default (see case #1 in my message above), timeout in Python wrapping object 
is -1 (self->Socket->sock_timeout==-1). But underlying NT socket is really 
non-blocking. This leads to 100% CPU load: PySSL_SSLdo_handshake() loop is 
calling check_socket_and_wait_for_timeout() which immediately returns.

NB. I use Python 2.7.6 and openssl-0.9.8y for my build and never tried Python 3.

--

___
Python tracker 

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



[issue21117] inspect.signature: inaccuracies for partial functions

2014-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset acbdbf2b06e0 by Yury Selivanov in branch '3.4':
inspect.signautre: Fix functools.partial support. Issue #21117
http://hg.python.org/cpython/rev/acbdbf2b06e0

New changeset 21709cb4a8f5 by Yury Selivanov in branch 'default':
inspect.signautre: Fix functools.partial support. Issue #21117
http://hg.python.org/cpython/rev/21709cb4a8f5

--
nosy: +python-dev

___
Python tracker 

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



[issue21117] inspect.signature: inaccuracies for partial functions

2014-04-08 Thread Yury Selivanov

Changes by Yury Selivanov :


--
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



[issue20334] make inspect Signature hashable

2014-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 932d69ef0c63 by Yury Selivanov in branch 'default':
inspect: Make Signature and Parameter hashable. Issue #20334.
http://hg.python.org/cpython/rev/932d69ef0c63

--
nosy: +python-dev

___
Python tracker 

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



[issue20334] make inspect Signature hashable

2014-04-08 Thread Yury Selivanov

Changes by Yury Selivanov :


--
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



[issue19281] add __objclass__ to the docs

2014-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0973d45197cc by Yury Selivanov in branch '3.4':
docs: Document __objclass__. Closes #19281.
http://hg.python.org/cpython/rev/0973d45197cc

New changeset 2a953cb5642d by Yury Selivanov in branch 'default':
docs: Document __objclass__. Closes #19281.
http://hg.python.org/cpython/rev/2a953cb5642d

--
nosy: +python-dev
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue21144] ensurepip "AssertionError: Multiple .dist-info directories"

2014-04-08 Thread Nikolaus Demmel

Nikolaus Demmel added the comment:

I could resolve this by removing /usr/local/lib/python3.4/site-packages and 
then retrying. Now I cannot reproduce this issue any more.

Maybe we can close this issue.

--

___
Python tracker 

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



[issue21139] Idle: change default reformat width from 70 to 72

2014-04-08 Thread Saimadhav Heblikar

Changes by Saimadhav Heblikar :


Added file: http://bugs.python.org/file34764/issue21139-34.patch

___
Python tracker 

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



[issue21139] Idle: change default reformat width from 70 to 72

2014-04-08 Thread Saimadhav Heblikar

Saimadhav Heblikar added the comment:

Attaching a patch for 2.7 and 3.4
The comment strings are modified to reflect 70->72 in the tests.

--
keywords: +patch
Added file: http://bugs.python.org/file34763/issue21139-27.patch

___
Python tracker 

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



[issue21181] Inconsistent Definition of collections.namedtuple.__dict__ in _source

2014-04-08 Thread Jim Peterson

New submission from Jim Peterson:

The result returned by somenamedtuple._source seem inconsistent, in that it 
defines __dict__ as:

__dict__ = property(_asdict)

even though it imports property as:

from builtins import property as _property

and the namedtuple fields are defined using _property, instead.  It still 
compiles and functions properly, but whatever compelled the developer to 
declare the named fields using _property seems to be ignored in the definition 
of __dict__.

--
components: Library (Lib)
messages: 215772
nosy: Jim.Peterson
priority: normal
severity: normal
status: open
title: Inconsistent Definition of collections.namedtuple.__dict__ in _source
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue21146] update gzip usage examples in docs

2014-04-08 Thread Wolfgang Maier

Wolfgang Maier added the comment:

ok, I've prepared the patch using the elegant shutil solution.

--
keywords: +patch
Added file: http://bugs.python.org/file34765/gzip_example_usage_patch.diff

___
Python tracker 

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



[issue21180] Cannot efficiently create empty array.array of given size, inconsistency with bytearray

2014-04-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

>>> array.array('i', [0]) * 3
array('i', [0, 0, 0])

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue19281] add __objclass__ to the docs

2014-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 372b19005011 by Yury Selivanov in branch '3.4':
docs: Better wording for __objclass__ docs. Issue #19281
http://hg.python.org/cpython/rev/372b19005011

New changeset febd63a7e927 by Yury Selivanov in branch 'default':
docs: Better wording for __objclass__ docs. Issue #19281
http://hg.python.org/cpython/rev/febd63a7e927

--

___
Python tracker 

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



[issue21144] ensurepip "AssertionError: Multiple .dist-info directories"

2014-04-08 Thread Ned Deily

Ned Deily added the comment:

That error appears to be coming from wheel.py inside of pip.  So, if you do 
want to pursue it, you should probably be asking on the pip tracker:

https://github.com/pypa/pip/issues

--
nosy: +ned.deily
resolution:  -> 3rd party
stage:  -> committed/rejected
status: open -> closed
type: crash -> 

___
Python tracker 

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



[issue11588] Add "necessarily inclusive" groups to argparse

2014-04-08 Thread paul j3

paul j3 added the comment:

http://stackoverflow.com/questions/22929087
A question that could be addressed with this patch(es)

In a subparser:

I have 4 arguments: -g, -wid, -w1, and -w2.

-w1 and -w2 always appear together

-wid and (-w1 -w2) are mutually exclusive, but one or the other is required

-g is optional; if it is not specified only (-w1 -w2) can appear, but not 
-wid

The `g` case does not fit either the inclusive or exclusive group patterns.

--

___
Python tracker 

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



[issue9066] Standard type codes for array.array, same as struct

2014-04-08 Thread Josh Rosenberg

Changes by Josh Rosenberg :


--
nosy: +josh.rosenberg

___
Python tracker 

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



[issue21181] Inconsistent Definition of collections.namedtuple.__dict__ in _source

2014-04-08 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue21181] Inconsistent Definition of collections.namedtuple.__dict__ in _source

2014-04-08 Thread Eric Snow

Changes by Eric Snow :


--
nosy: +rhettinger

___
Python tracker 

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



[issue21169] getpass.getpass() fails with non-ASCII characters in prompt

2014-04-08 Thread Kushal Das

Kushal Das added the comment:

Here is a patch which stops the breakage in getpass for python3.

--
keywords: +patch
nosy: +kushaldas
Added file: http://bugs.python.org/file34766/issue21169.patch

___
Python tracker 

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



[issue21169] getpass.getpass() fails with non-ASCII characters in prompt

2014-04-08 Thread Kushal Das

Kushal Das added the comment:

Version 2 of the patch with a test update.

--
Added file: http://bugs.python.org/file34767/issue21169_v2.patch

___
Python tracker 

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



[issue21182] json.loads errors out on valid JSON

2014-04-08 Thread Yakov Keselman

New submission from Yakov Keselman:

Run the following Python JSON parsing script on valid JSON:

import json
json.loads( '["[\"Residential | Furniture | Cabinets\",\"119.99\"]"]' )

Result:

Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python33\lib\json\__init__.py", line 319, in loads
return _default_decoder.decode(s)
  File "C:\Python33\lib\json\decoder.py", line 352, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python33\lib\json\decoder.py", line 368, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting ',' delimiter: line 1 column 5 (char 4)

--
components: IO
messages: 215780
nosy: Yakov.Keselman
priority: normal
severity: normal
status: open
title: json.loads errors out on valid JSON
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-08 Thread Vinay Sajip

Vinay Sajip added the comment:

Thanks for pinpointing what the issue is.

> checking for isinstance(..., dict) is still wrong - it should at least
> be collections.Mapping to give users a chance to emulate the correct
> interface.

That seems reasonable.

--
resolution: invalid -> 

___
Python tracker 

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



[issue21166] Bus error on "AMD64 FreeBSD 9.x 3.4" buildbot

2014-04-08 Thread STINNER Victor

STINNER Victor added the comment:

I still don't understand the issue but... it's now fixed (I don't understand 
why), so I'm closing it.

--
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



[issue21168] unicodeobject.c: likely type-punning may break strict-aliasing rules

2014-04-08 Thread STINNER Victor

STINNER Victor added the comment:

This issue was a follow up of issue #21166, but in fact the two issues are 
unrelated, and this issue is a false alarm.

I don't see how to make the GCC warning quiet, and GCC 4.2 is now old, so I'm 
closing the issue.

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue5845] rlcompleter should be enabled automatically

2014-04-08 Thread David Beazley

David Beazley added the comment:

Funny thing, this feature breaks the interactive interpreter in the most basic 
way on OS X systems.   For example, the tab key won't even work to indent.  You 
can't even type the most basic programs into the interactive interpreter. For 
example:

>>> for i in range(10):
...  print(i)

Oh sure, you can make it work by typing the space bar a bunch of times, but 
it's extremely annoying.  

The only way I was able to get a working interactive interpreter on my machine 
was to manually edit site.py and remove the call to enablerlcompleter() from 
main().

I hope someone reconsiders this feature and removes it as default behavior.

--
nosy: +dabeaz

___
Python tracker 

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



[issue21147] sqlite3 doesn't complain if the request contains a null character

2014-04-08 Thread STINNER Victor

STINNER Victor added the comment:

Here is a first patch. I only tested the execute() method.

--
keywords: +patch
nosy: +ghaering
Added file: http://bugs.python.org/file34768/sqlite_null.patch

___
Python tracker 

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



[issue19977] Use "surrogateescape" error handler for sys.stdin and sys.stdout on UNIX for the C locale

2014-04-08 Thread STINNER Victor

STINNER Victor added the comment:

"However, I'd still like to discuss the idea of backporting this to 3.4.1."

THe idea of doing this change in Python 3.5 is that I have no idea of the risk 
of regression. To backport such change in a minor version (3.4.1), I would feel 
more confident with user tests of Python 3.5 or patched Python 3.4.

"That has long made Toshio nervous about the migration of core services to 
Python 3 (https://fedoraproject.org/wiki/Changes/Python_3_as_Default), and his 
concerns make sense to me, as that migration covers little things like the 
installer, package manager, post-image install initialisation, etc. "

Which programs in this test are or may be running with the POSIX locale?

Fedora doesn't use en_US.utf8 locale by default?

--

___
Python tracker 

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



[issue20644] OS X installer build broken by changes to documentation build

2014-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 01f1e14cad23 by Ned Deily in branch '3.4':
Issue #20644: OS X installer build support for documentation build changes
http://hg.python.org/cpython/rev/01f1e14cad23

New changeset 7d004ad09bf5 by Ned Deily in branch 'default':
Issue #20644: merge from 3.4
http://hg.python.org/cpython/rev/7d004ad09bf5

--
nosy: +python-dev

___
Python tracker 

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



[issue21181] Inconsistent Definition of collections.namedtuple.__dict__ in _source

2014-04-08 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> whatever compelled the developer to declare the named fields 
> using _property seems to be ignored in the definition of __dict__.

What compelled the _property alias is that the user could name an attribute 
"property" which would cause a conflict if _property has not been renamed.  

For example:

   T = namedtuple('T', ['property', 'plant', 'equipment'])

would create the following field definitions:

property = _property(_itemgetter(0), doc='Alias for field number 0')

plant = _property(_itemgetter(1), doc='Alias for field number 1')

equipment = _property(_itemgetter(2), doc='Alias for field number 2')

Note, if we didn't use _property, the builtin property() would be shadowed.

The code for __dict__ occurs upstream (before the field definitions), so it is 
safe from redefinition:

@property
def __dict__(self):
'A new OrderedDict mapping field names to their values'
return OrderedDict(zip(self._fields, self))

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue20644] OS X installer build broken by changes to documentation build

2014-04-08 Thread Ned Deily

Ned Deily added the comment:

build-installer.py now assumes that sphinx-build and the previously required hg 
have been installed somewhere on the restricted PATH that the installer uses.  
Behind the scenes, the installer build process has been substantially revised 
to make use of a bootstrapped Python 2.7 instance on OS X 10.5 and 10.6 for the 
use of hg and sphinx-build, since the current version of sphinx-build requires 
at least Python 2.6 thus the 10.5 system Python 2.5 no longer suffices.

--
priority: deferred blocker -> 
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed
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



[issue21119] asyncio create_connection resource warning

2014-04-08 Thread STINNER Victor

STINNER Victor added the comment:

Updated patch (close-3.patch) combining create_connection_close.patch  and 
close2.patch and adding unit tests. I also improved the create_connection() 
test to raise the TimeoutError on connect() (loop.sock_connect), not on 
sock.set_blocking().

--
Added file: http://bugs.python.org/file34769/close-3.patch

___
Python tracker 

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



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

2014-04-08 Thread STINNER Victor

STINNER Victor added the comment:

Here is a patch. I don't see how to write a unit test.

--
keywords: +patch
Added file: http://bugs.python.org/file34770/addch.patch

___
Python tracker 

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



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

2014-04-08 Thread STINNER Victor

STINNER Victor added the comment:

> Redirecting the test to a file fails because curses complains stdio isn't a 
> tty.

You may create a the pty module for that.
https://docs.python.org/dev/library/pty.html#pty.openpty

--

___
Python tracker 

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



[issue12546] builtin __format__ methods cannot fill with \x00 char

2014-04-08 Thread STINNER Victor

STINNER Victor added the comment:

The patch looks good to me.

--
type: behavior -> enhancement
versions:  -Python 2.7, Python 3.4

___
Python tracker 

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



[issue21179] Rounding half to even

2014-04-08 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Python 3.2-3.4 (probably all of 3.x) use round half even, but testing 2.7.3 on 
Ubuntu confirms what you say. In terms of the decimal constants, Py2.7 round() 
appears to use decimal.ROUND_HALF_UP behavior while 3.x uses 
decimal.ROUND_HALF_EVEN behavior.

Looks like someone accidentally copied Py3 docs down to Py2; according to 
https://docs.python.org/3/whatsnew/3.0.html :

>The round() function rounding strategy and return type have changed. Exact 
>halfway cases are now rounded to the nearest even result instead of away from 
>zero. (For example, round(2.5) now returns 2 rather than 3.) round(x[, n]) now 
>delegates to x.__round__([n]) instead of always returning a float. It 
>generally returns an integer when called with a single argument and a value of 
>the same type as x when called with two arguments.

Looks like the behaviors never changed, but the docs for round in Py2 are 
incorrect.

--
nosy: +josh.rosenberg

___
Python tracker 

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



[issue21097] Move test_namespace_pkgs into test_importlib.

2014-04-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 99265d30fa38 by Ned Deily in branch '3.4':
Issue #21097: Update Makefile with changed install locations of test 
directories.
http://hg.python.org/cpython/rev/99265d30fa38

New changeset 7aae2b9fcfad by Ned Deily in branch 'default':
Issue #21097: merge from 3.4
http://hg.python.org/cpython/rev/7aae2b9fcfad

--

___
Python tracker 

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



[issue21183] Doctest capture only AssertionError but not printed text

2014-04-08 Thread Osvaldo Santana Neto

New submission from Osvaldo Santana Neto:

The following doctest should pass, but it fails:

>>> def spam(): print("eggs")
...
>>> assert spam()
eggs
Traceback (most recent call last):
AssertionError

But if we remove the print output from printed results the test pass:

>>> def spam(): print("eggs")
...
>>> assert spam()
Traceback (most recent call last):
AssertionError

I'm writing the 2nd edition of a book about Python (covering python3) and 
Django and I'm using doctest to run the interactive sessions that I use as 
examples in book.

--
components: Library (Lib)
files: doctest_bug.py
messages: 215796
nosy: osantana
priority: normal
severity: normal
status: open
title: Doctest capture only AssertionError but not printed text
type: behavior
versions: Python 2.7, Python 3.4
Added file: http://bugs.python.org/file34771/doctest_bug.py

___
Python tracker 

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



[issue21183] Doctest capture only AssertionError but not printed text

2014-04-08 Thread Tim Peters

Tim Peters added the comment:

The first footnote in the docs explain this:

Examples containing both expected output and an
exception are not supported. Trying to guess where
one ends and the other begins is too error-prone,
and that also makes for a confusing test.

So, sorry, but this is intentionally not supported.

--
nosy: +tim.peters

___
Python tracker 

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



[issue21183] Doctest capture only AssertionError but not printed text

2014-04-08 Thread Osvaldo Santana Neto

Osvaldo Santana Neto added the comment:

Hi Tim,

I tried to find more information in documentation before opening this bug but I 
need to confess that I didn't read the footnote.

Thanks and sorry for the invalid report.

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue21183] Doctest capture only AssertionError but not printed text

2014-04-08 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Personally, I think that the second reason given in the footnote, that it makes 
for confusing tests, is bogus, or at least it's a matter of opinion. I for one 
don't think they are confusing, and would like to see mixed output/tracebacks 
supported. Tim, would you accept this being reopened as an Enhancement request 
for 3.5 rather than a bug fix?

--
nosy: +stevenjd

___
Python tracker 

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



[issue21183] Doctest capture only AssertionError but not printed text

2014-04-08 Thread Tim Peters

Tim Peters added the comment:

Steven, no objection here.

--

___
Python tracker 

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



[issue21170] Incorrect signature for unittest.TestResult.startTestRun(), .stopTestRun()

2014-04-08 Thread Kushal Das

Kushal Das added the comment:

Here is a patch which fixes the documentation for unittest.

--
keywords: +patch
nosy: +kushaldas
Added file: http://bugs.python.org/file34772/issue21170.patch

___
Python tracker 

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



[issue21184] statistics.pvariance with known mean does not work as expected

2014-04-08 Thread Steven D'Aprano

New submission from Steven D'Aprano:

If you know the population mean mu, you should calculate the sample variance by 
passing mu as an explicit argument to statistics.pvariance. Unfortunately, it 
doesn't work as designed:

py> data = [1, 2, 2, 2, 3, 4]  # sample from a population with mu=2.5
py> statistics.pvariance(data)  # uses the sample mean 2....
0.
py> statistics.pvariance(data, 2.5)  # using known population mean
0.

The second calculation ought to be 0.91666... not 0.8...

The problem lies with the _ss private function which calculates the sum of 
square deviations. Unfortunately it is too clever: it includes an error 
adjustment term

ss -= _sum((x-c) for x in data)**2/len(data)

which mathematically is expected to be zero when c is calculated as the mean of 
data, but due to rounding may not be quite zero. But when c is given 
explicitly, as happens if the caller provides an explicit mu argument to 
pvariance, then the error adjustment has the effect of neutralizing the 
explicit mu.

The obvious fix is to just skip the adjustment in _ss when c is explicitly 
given, but I'm not sure if that's the best approach.

--
assignee: stevenjd
components: Library (Lib)
messages: 215802
nosy: stevenjd
priority: normal
severity: normal
stage: needs patch
status: open
title: statistics.pvariance with known mean does not work as expected
type: behavior
versions: Python 3.4, Python 3.5

___
Python tracker 

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



[issue21183] Doctest capture only AssertionError but not printed text

2014-04-08 Thread Steven D'Aprano

Changes by Steven D'Aprano :


--
resolution: invalid -> 
stage:  -> needs patch
status: closed -> open
type: behavior -> enhancement
versions: +Python 3.5 -Python 2.7, Python 3.4

___
Python tracker 

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



[issue21182] json.loads errors out on valid JSON

2014-04-08 Thread Kushal Das

Kushal Das added the comment:

It is not a valid JSON. You may want to validate it against http://jsonlint.com/

What you have inside the string (single quotes) is the JSON representation but 
not the string representation which json.loads is supposed to parse.

--
nosy: +kushaldas

___
Python tracker 

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



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

2014-04-08 Thread Larry Hastings

Larry Hastings added the comment:

How about examining the inspect.Signature?

--

___
Python tracker 

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



[issue21170] Incorrect signature for unittest.TestResult.startTestRun(), .stopTestRun()

2014-04-08 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +ezio.melotti, michael.foord
stage:  -> patch review
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