[issue27761] Private _nth_root function loses accuracy

2016-08-16 Thread Tim Peters

Tim Peters added the comment:

Noting that `floor_nroot` can be sped a lot by giving it a better starting 
guess.  In the context of `nroot`, the latter _could_ pass `int(x**(1/n))` as 
an excellent starting guess.  In the absence of any help, this version figures 
that out on its own; an optional `a=None` argument (to supply a starting guess, 
if desired) would make sense.

def floor_nroot(x, n):
"""For positive integers x, n, return the floor of the nth root of x."""

bl = x.bit_length()
if bl <= 1000:
a = int(float(x) ** (1.0/n))
else:
xhi = x >> (bl - 53)
# x ~= xhi * 2**(bl-53)
# x**(1/n) ~= xhi**(1/n) * 2**((bl-53)/n)
# Let(bl-53)/n = w+f where w is the integer part.
# 2**(w+f) is then 2**w * 2**f, where 2**w is a shift.
a = xhi ** (1.0 / n)
t = (bl - 53) / n
w = int(t)
a *= 2.0 ** (t - w)
m, e = frexp(a)
a = int(m * 2**53)
e += w - 53
if e >= 0:
a <<= e
else:
a >>= -e
# A guess of 1 can be horribly slow, since then the next
# guess is approximately x/n.  So force the first guess to
# be at least 2.  If that's too large, fine, it will be
# cut down to 1 right away.
a = max(a, 2)
a = ((n-1)*a + x // a**(n-1)) // n
while True:
d = x // a**(n-1)
if a <= d:
return a
a = ((n-1) * a + d) // n

I haven't yet found a case in the context of `nroot` where it doesn't get out 
on the first `if a <= d:` test.  Of course you can provoke as many iterations 
as you like by passing `x` with a lot more than 53 "significant" bits (the 
large `x` passed by `nroot` are mostly long strings of trailing 0 bits).

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The use of a bare identifier as a self-assigning statement is unprecedented in 
the world of Python.  PyFlakes flags it as an error (because prior to now, a 
bare identifier in a class statement was almost always an error).  I suspect 
this will cause issues with other static analysis and refactoring tools as well:

--- tmp_enum_example.py -
from enum import AutoEnum

class Color(AutoEnum):
red
green = 5
blue

print(list(Color))

--- bash session 
$ py -m pyflakes tmp_enum_example.py
tmp_enum_example.py:4: undefined name 'red'
tmp_enum_example.py:6: undefined name 'blue'
tmp_enum_example.py:11: undefined name 'yellow'


Also, the usual technique of commenting out blocks with triple quotes 
introduces unexpected breakage:

--- tmp_enum_example2.py -
from enum import AutoEnum

class Color(AutoEnum):
red
green = 5
blue
''' XXX temporarily comment these out
brown
orange
'''
yellow

print(list(Color))

--- bash session 
$ py -m tmp_enum_example.py
[, , , ]
/Users/raymond/cpython/python.exe: Error while finding spec for
'tmp_enum_example.py' (AttributeError: module 'tmp_enum_example'
has no attribute '__path__')

I worry that this proposal is worse than just being non-idiomatic Python.  In a 
way, it undermines pillars of the language and conflict everyone's mental model 
of how the language works.  Historically, a bare variable name raised a 
NameError if undefined and would otherwise act as a expression who's result was 
discarded.  However, as used here, it fiats an attribute into existence and 
assigns it a value.  That to my eyes looks like a new language that isn't 
Python.  This is really weird and undermines my expectations.

The need for the "ignore" parameter for the "shielded set" is a hint that the 
patch is working against the grain of the language and is not in harmony with 
Python as a coherent whole.  It is a harbinger of problems to come.

Lastly, I question whether there is any real problem being solved.  You already 
have "Color = IntEnum('Animal', 'red green blue')" that works well enough, 
doesn't mess with language norms, that works nicely with triple quotes for 
multiline entries, and that extends easily to hundreds of constants.

It seems to me that too much magic and unidiomatic weirdness are being leveled 
at too small of a problem.  Plus we already have one way to do it.

In teaching people to make effective use of the language, a key learning point 
is learning the portents of trouble to come and recognizing that that not 
everything that can be made to work should actually be done.

Please reconsider whether you really want to open this Pandora's box.  Right 
now, it's not too late.  No doubt that you will find some people who like this 
(it reminds them of C), but you will also find some very experienced developers 
who are made queasy by the bare identifier transforming from an expression into 
an assigning statement.  This more than an "if you don't like it, don't use it" 
decision, I think an important and invisible line is being crossed that we will 
regret.

P.S.  A lesson I learned from maintaining the itertools module is that adding 
more variants of a single idea tends to make the overall toolkit harder to 
learn and impairs usability.  Users suffer when given too many choices for 
closely related tasks.  The "one way to do it" line in the Zen of Python is 
there for a reason.

--
nosy: +rhettinger

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-16 Thread Decorater

Decorater added the comment:

I personally hate ansi myself so +1 to UTF-8/UTF-16.

--
nosy: +Decorater

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-16 Thread Steve Dower

New submission from Steve Dower:

I've attached my first pass at a patch to change the file system encoding on 
Windows to UTF-8 and remove use of the *A APIs.

It would be trivial to change the encoding from UTF-8 back to CP_ACP and change 
the error mode if that's what we decide is better, but my vote is strongly for 
an encoding that never drops characters when converted from UTF-16.

Discussion is still ongoing on python-ideas, so let's argue about yes/no and 
utf-8/mbcs there and just discuss the patch here.

--
assignee: steve.dower
components: Windows
files: fsencoding.diff
keywords: patch
messages: 272899
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: Change sys.getfilesystemencoding() on Windows to UTF-8
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file44130/fsencoding.diff

___
Python tracker 

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



[issue27779] Sync-up docstrings in C version of the the decimal module

2016-08-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Historically, we've kept the docstrings 100% intact between the C and Python 
versions, even if they are big (see heapq.__doc__) for example.

If there are differences in the "hand written" versions. I would like to have 
them compared on a case by case basis and resolved.   Unless the C version 
implements something different, there should be no reason for a docstring 
difference.  The originals are very close to the specification and to the 
documentation.  We tried to stay true in part because there are so many 
niggling details that it would be hard to know without reading the spec.

--

___
Python tracker 

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



[issue27395] Patch to Increase test coverage of unittest.runner.TextTestResult

2016-08-16 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
stage:  -> patch review
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



[issue16764] Make zlib accept keyword-arguments

2016-08-16 Thread Xiang Zhang

Xiang Zhang added the comment:

Serhiy, the message added in Misc/NEWS should be in Library section not Core 
and Builtins section.

--

___
Python tracker 

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



[issue6143] IDLE - an extension to clear the shell window

2016-08-16 Thread Martin Panter

Changes by Martin Panter :


--
nosy:  -martin.panter

___
Python tracker 

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



[issue27749] python 3.5.2 maybe crash in windows

2016-08-16 Thread wevsty

Changes by wevsty :


--
title: python 3.5.2 maybe crash -> python 3.5.2 maybe crash in windows

___
Python tracker 

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



[issue24648] Allocation of values array in split dicts should use small object allocator.

2016-08-16 Thread Emanuel Barry

Emanuel Barry added the comment:

One needs to have the "Developer" role (i.e. can triage issues) to be assigned 
:)

--
nosy: +ebarry

___
Python tracker 

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



[issue24648] Allocation of values array in split dicts should use small object allocator.

2016-08-16 Thread STINNER Victor

STINNER Victor added the comment:

In Python 3.6, PyMem_Malloc() is now an alias to PyObject_Malloc(), both 
functions use the pymalloc allocator: see the issue #26249.

This issue can now be closed.

--

Note: I created the issue #26249 when I saw the good results of the issue 
#23601. In fact, I had the idea when I wrote tracemalloc, but I chose to defer 
the idea because some people expected regressions. PYTHONMALLOC=debug should 
now help to find and debug issues:
https://docs.python.org/dev/whatsnew/3.6.html#pythonmalloc-environment-variable

--

___
Python tracker 

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



[issue24648] Allocation of values array in split dicts should use small object allocator.

2016-08-16 Thread Larry Hastings

Larry Hastings added the comment:

Assigning to myself on behalf of "aniawsz".  I actually want to assign it to 
her but for some reason I can't.  (Maybe because she doesn't have the commit 
bit?)

--
assignee:  -> larry

___
Python tracker 

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



[issue24648] Allocation of values array in split dicts should use small object allocator.

2016-08-16 Thread Larry Hastings

Changes by Larry Hastings :


--
nosy: +aniawsz, larry

___
Python tracker 

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



[issue27756] Add pyd icon for 3.6

2016-08-16 Thread Steve Dower

Steve Dower added the comment:

It's probably not worth doing pyw.exe - even distinguishing between python.exe 
and pythonw.exe is only possible because we came up with that icon before the 
alternative one for the launcher.

The style just imitates the icon in the Run dialog (the "feeling of speed"), 
it's not the same image. Only the Python logo is a concern, but we're allowed 
to use that one :)

--

___
Python tracker 

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



[issue27756] Add pyd icon for 3.6

2016-08-16 Thread Eryk Sun

Eryk Sun added the comment:

Should pyw.exe get its own icon? Otherwise these look good to me; they're less 
busy than the existing icons, which is probably for the best. Is there a 
potential licensing problem with borrowing the look of the Win+R dialog icon, 
or is this fair use?

--

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-16 Thread STINNER Victor

STINNER Victor added the comment:

> 5) Reverted changes in Objects/descrobject.c. They added a regression in
> namedtuple attributes access.

Oh, I now understand. The change makes "namedtuple.attr" slower. With 
fastcall-3.patch attached to this issue, the fast path is not taken on this 
benchmark, and so you loose the removed optimization (tuple cached in the 
modified descriptor function).

In fact, you need the "full" fastcall change to make this attribute lookup 
*faster*:
https://bugs.python.org/issue26814#msg263999

So yeah, it's better to wait until more changes are merged.

--

___
Python tracker 

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



[issue27756] Add pyd icon for 3.6

2016-08-16 Thread Steve Dower

Steve Dower added the comment:

Got an impressively quick response from one of our willing designers, who has 
proposed the attached icons.

In order, they would be:
* pythonw.exe
* py.exe (for reference, this mimics the Run launcher icon in Win10)
* All .py
* python.exe
* All .pyc
* All .pyd

Any suggestions or comments? I personally think they look great.

--
assignee:  -> steve.dower
stage:  -> patch review
type:  -> enhancement
Added file: http://bugs.python.org/file44129/ProposedIcons.png

___
Python tracker 

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



[issue27780] Memory leak during Python build (from git c3ff7e7) on Debian 8.5 x64

2016-08-16 Thread geeknik

New submission from geeknik:

CC=afl-clang-fast CXX=afl-clang-fast++ AFL_USE_ASAN=1 ./configure --disable-ipv6

Passes fine.

AFL_USE_ASAN=1 make

Ends with the following:

Parser/pgen ./Grammar/Grammar Include/graminit.h Python/graminit.c

=
==29392==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 12416 byte(s) in 8 object(s) allocated from:
#0 0x4a1f2e in realloc (/root/cpython/Parser/pgen+0x4a1f2e)
#1 0x4cfcca in PyMem_RawRealloc /root/cpython/Objects/obmalloc.c:414:12

Indirect leak of 2080 byte(s) in 3 object(s) allocated from:
#0 0x4a1f2e in realloc (/root/cpython/Parser/pgen+0x4a1f2e)
#1 0x4cfcca in PyMem_RawRealloc /root/cpython/Objects/obmalloc.c:414:12

Indirect leak of 898 byte(s) in 86 object(s) allocated from:
#0 0x4a1c3b in __interceptor_malloc (/root/cpython/Parser/pgen+0x4a1c3b)
#1 0x7fbd7abe3989 in __strdup 
/build/glibc-uPj9cH/glibc-2.19/string/strdup.c:42

Indirect leak of 520 byte(s) in 1 object(s) allocated from:
#0 0x4a1c3b in __interceptor_malloc (/root/cpython/Parser/pgen+0x4a1c3b)
#1 0x4d3fa0 in PyMem_RawMalloc /root/cpython/Objects/obmalloc.c:396:12
#2 0x4d3fa0 in _PyObject_Alloc /root/cpython/Objects/obmalloc.c:1467

Indirect leak of 178 byte(s) in 33 object(s) allocated from:
#0 0x4a1c3b in __interceptor_malloc (/root/cpython/Parser/pgen+0x4a1c3b)
#1 0x4c6756 in translabel /root/cpython/Parser/grammar.c:197:28
#2 0x4c6756 in _Py_translatelabels /root/cpython/Parser/grammar.c:141

SUMMARY: AddressSanitizer: 16092 byte(s) leaked in 131 allocation(s).
Makefile:804: recipe for target 'Include/graminit.h' failed
make: *** [Include/graminit.h] Error 23

--
components: Build
messages: 272889
nosy: geeknik
priority: normal
severity: normal
status: open
title: Memory leak during Python build (from git c3ff7e7) on Debian 8.5 x64

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-16 Thread STINNER Victor

STINNER Victor added the comment:

Patch version 3: simpler and shorter patch

* _PyObject_FastCall() keeps its kwargs parameter, but it must always be NULL. 
Support for keyword arguments will be added later.
* I removed PyObject_CallNoArg() and PyObject_CallArg1()
* I moved _PyStack_AsTuple() to Objects/abstract.c. A temporary home until the 
API grows until to require its own file (Python/pystack.c).

I also pushed some changes unrelated to fastcall in Python/ceval.c to simplify 
the patch.

Very few functions are modified (directly or indirectly) to use 
_PyObject_FastCall():

- PyEval_CallObjectWithKeywords()
- PyObject_CallFunction()
- PyObject_CallMethod()
- _PyObject_CallMethodId()

Much more will come in following patches.

--
Added file: http://bugs.python.org/file44128/fastcall-3.patch

___
Python tracker 

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



[issue18295] Possible integer overflow in PyCode_New()

2016-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e615718a6455 by Victor Stinner in branch 'default':
Use Py_ssize_t in _PyEval_EvalCodeWithName()
https://hg.python.org/cpython/rev/e615718a6455

--
nosy: +python-dev

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 288ec55f1912 by Victor Stinner in branch 'default':
Issue #27128: Cleanup _PyEval_EvalCodeWithName()
https://hg.python.org/cpython/rev/288ec55f1912

New changeset e615718a6455 by Victor Stinner in branch 'default':
Use Py_ssize_t in _PyEval_EvalCodeWithName()
https://hg.python.org/cpython/rev/e615718a6455

--
nosy: +python-dev

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-16 Thread STINNER Victor

STINNER Victor added the comment:

FYI Raymond Hettinger started a discussion on Twitter about this feature, and 
the feedback may not be as good as you expected:
https://twitter.com/raymondh/status/765652816849285120

(I dislike this new magic thing, but I also never used the enum module, so I'm 
not sure that my opinion matters ;-))

--
nosy: +haypo

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-16 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka added the comment:
>> Do you suggest to not add these 2 new functions?
>
> Yes, I suggest to not add them. The API for calling is already too large.
> Internally we can directly use _PyObject_FastCall(), and third party code
> should get benefit from optimized PyObject_CallFunctionObjArgs().

Well, we can start without them, and see later if it's worth it.

I didn't propose to add new functions to make the code faster, but to
make the API simpler.

I dislike PyEval_CallObjectWithKeywords(func, arg, kw) because it has
a special case if arg is a tuple. If arg is a tuple, the tuple is
unpacked. It already leaded to a complex and very bug in the
implementation of generators! See the issue #21209. I'm not sure that
such use case is well known and understood by everyone...

It's common to call a function with no argument or just one argument,
so I proposed to add an obvious and simple API for these common cases.
Well, again, I will open a new issue to discuss that.

>> > Can existing function PyObject_Call() be optimized to achieve a
>> > comparable benefit?
>> Sorry, I don't understand. This function requires a tuple. The whole
>> purpose of my patch is to avoid temporary tuples.
>
> Sorry, I meant PyObject_CallFunctionObjArgs() and like.

Yes, my full patch does optimize these functions:
https://hg.python.org/sandbox/fastcall/file/2dc558e01e66/Objects/abstract.c#l2523

>> Keyword arguments are optional. Having support for them cost nothing when
>> they are not used.
>
> My point is that if keyword arguments are used, this is not a fast call, and
> should use old calling protocol. The overhead of creating a tuple for args is
> dwarfen by the overhead of creating a dict for kwargs and parsing it.

I'm not sure that I understand your point.

For example, in my full patch, I have a METH_FASTCALL calling
convention for C functions. With this calling convention, a function
accepts positional arguments and keyword arguments. If you don't pass
keyword arguments, the call should be faster according to my
benchmarks.

How do you want to implement METH_FASTCALL if you cannot pass keyword
arguments? Does it mean that METH_FASTCALL can only be used by the
functions which don't accept keyword arguments at all?

It's ok if passing keyword arguments is not faster, but simply as fast
as before, if the "positional arguments only" case is faster, no?

>> I really want to have a "pystack" API. In this patch, the new file looks
>> useless, but in the full patch there are many functions including a few
>> complex functions. I prefer to add the file now and complete it later.
>
> But for now there is no a "pystack" API. What do you want to add?

See my fastcall branch:

https://hg.python.org/sandbox/fastcall/file/2dc558e01e66/Include/pystack.h
https://hg.python.org/sandbox/fastcall/file/2dc558e01e66/Python/pystack.c

All these functions are private. They are used internally to implement
all functions of the Python C API to call functions.

> On other side, other code can get a benefit from using _PyTuple_FromArray().

Ah? Maybe you should open a different issue for that.

I prefer to have an API specific to build a "stack" to call functions.

> Here is alternative simplified patch.
>
> 1) _PyStack_AsTuple() is renamed to _PyTuple_FromArray() (-2 new files).
> 2) Optimized PyObject_CallFunctionObjArgs(), PyObject_CallMethodObjArgs() and
> _PyObject_CallMethodIdObjArgs().

My full patch does optimize "everything", it's deliberate to start
with something useless but short.

> 5) Reverted changes in Objects/descrobject.c. They added a regression in
> namedtuple attributes access.

Ah? What is the regression?

--

___
Python tracker 

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



[issue27645] Supporting native backup facility of SQLite

2016-08-16 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +ghaering

___
Python tracker 

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



[issue27395] Patch to Increase test coverage of unittest.runner.TextTestResult

2016-08-16 Thread Pam McA'Nulty

Changes by Pam McA'Nulty :


--
title: Increase test coverage of unittest.runner.TextTestResult -> Patch to 
Increase test coverage of unittest.runner.TextTestResult

___
Python tracker 

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



[issue24905] Allow incremental I/O to blobs in sqlite3

2016-08-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Added comments on Rietveld. The patch contains typos and violates PEP 7 and PEP 
12. And there are questions about API.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27181] Add geometric mean to `statistics` module

2016-08-16 Thread STINNER Victor

STINNER Victor added the comment:

I would like to use buildbots to check for regressions, but I see a lot of red 
buildbots, so buildbots became useless :-/

I skipped failing test_statistics tests, since failures are known.

I put the priority to "release blocker".

I suggest to either revert the change or find a fix before 3.6b1.

--
priority: normal -> release blocker

___
Python tracker 

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



[issue27181] Add geometric mean to `statistics` module

2016-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 54288b160243 by Victor Stinner in branch 'default':
Issue #27181: Skip tests known to fail until a fix is found
https://hg.python.org/cpython/rev/54288b160243

--

___
Python tracker 

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



[issue27181] Add geometric mean to `statistics` module

2016-08-16 Thread STINNER Victor

STINNER Victor added the comment:

Failure on s390x Debian 3.x:

http://buildbot.python.org/all/builders/s390x%20Debian%203.x/builds/1455/steps/test/logs/stdio

==
FAIL: testExactPowers (test.test_statistics.Test_Nth_Root) (i=29, n=11)
--
Traceback (most recent call last):
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-debian-z/build/Lib/test/test_statistics.py",
 line 1216, in testExactPowers
self.assertEqual(self.nroot(x, n), i)
AssertionError: 29.004 != 29

==
FAIL: testExactPowersNegatives (test.test_statistics.Test_Nth_Root) (i=-29, 
n=11)
--
Traceback (most recent call last):
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-debian-z/build/Lib/test/test_statistics.py",
 line 1228, in testExactPowersNegatives
self.assertEqual(self.nroot(x, n), i)
AssertionError: -29.004 != -29

--
nosy: +haypo

___
Python tracker 

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



[issue27779] Sync-up docstrings in C version of the the decimal module

2016-08-16 Thread Stefan Krah

Stefan Krah added the comment:

I found the docstrings a bit too verbose (the power() docstring takes up more 
than a page), but I'm happy to add it and review a patch.

The patch authors need to take the hand written function signatures into 
account.

--
assignee: docs@python -> skrah
nosy: +skrah

___
Python tracker 

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



[issue27512] os.fspath is certain to crash when exception raised in __fspath__

2016-08-16 Thread Brett Cannon

Brett Cannon added the comment:

Thanks, I'll fix it at some point.

--

___
Python tracker 

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



[issue27512] os.fspath is certain to crash when exception raised in __fspath__

2016-08-16 Thread SilentGhost

SilentGhost added the comment:

Brett, Misc/NEWS entry needs a # before issue number.

--
nosy: +SilentGhost

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-16 Thread Ethan Furman

Ethan Furman added the comment:

added missing '#'

--

___
Python tracker 

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



[issue27779] Sync-up docstrings in C version of the the decimal module

2016-08-16 Thread Raymond Hettinger

New submission from Raymond Hettinger:

The pure python version of decimal has extensive docstrings with text and 
explanatory examples drawn directly from the decimal arithmetic specification.  
Those should all be copied to the C version as well.  This will improve 
usability for interactive use and improve help().

I would like to leave this work for one of the new aspiring core devs (perhaps 
Elizabeth, Lisa, or Nofar).

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 272875
nosy: docs@python, rhettinger
priority: normal
severity: normal
stage: needs patch
status: open
title: Sync-up docstrings in C version of the the decimal module
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-16 Thread John Hagen

John Hagen added the comment:

I think there is a small typo in the Changelog / What's New.  The Issue isn't 
hyper-linked:

https://docs.python.org/3.6/whatsnew/changelog.html#id2

--

___
Python tracker 

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



[issue24905] Allow incremental I/O to blobs in sqlite3

2016-08-16 Thread Aviv Palivoda

Aviv Palivoda added the comment:

Pinging as mentioned in the devguide.

--

___
Python tracker 

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



[issue27762] ConfigParser ignores in-line comments for lines with semi-colons

2016-08-16 Thread Łukasz Langa

Łukasz Langa added the comment:

I'm sorry but we can't do anything about this for Python 2.7 anymore. There's a 
big danger of altering how existing config files in the wild are being parsed, 
which is why we only broke compatibility once, with the release of Python 3.2. 
Even then, doing it very carefully, we found a few instances of painful parsing 
differences (.pypirc being the most widely spread example).

So, the fix here is to switch to Python 3 or use the configparser backport 
available on PyPI.

--
resolution:  -> wont fix

___
Python tracker 

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



[issue27762] ConfigParser ignores in-line comments for lines with semi-colons

2016-08-16 Thread Łukasz Langa

Changes by Łukasz Langa :


--
status: open -> closed

___
Python tracker 

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



[issue25628] Make namedtuple "verbose" and "rename" parameters into keyword only arguments

2016-08-16 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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



[issue27761] Private _nth_root function loses accuracy

2016-08-16 Thread Tim Peters

Tim Peters added the comment:

Thanks, Mark!  I had worked out the `floor_nroot` algorithm many years ago, but 
missed the connection to the AM-GM inequality.  As a result, instead of being 
easy, proving correctness was a pain that stretched over pages.  Delighted to 
see how obvious it _can_ be!

Just FYI, this was my "cheap" suggestion:

from fractions import Fraction

def rootn(x, n):
g = Fraction(x**(1.0/n))
g = ((n-1)*g + Fraction(x)/g**(n-1)) / n
return float(g)

For fun, I ran that and your `nroot` over several million random cases with `x` 
of the form

ldexp(random(), randrange(-500, 501))

and `n` in randrange(2, 501).

They always delivered the same result, which differed from `x**(1/n)` about a 
quarter of the time.  On average `nroot` took about 3.7 times longer.

But reducing the `n` range to randrange(1, 100), over half the time the 
(common) result differed from `x**(1/n)`, and `nroot` was significantly faster.

Moral of the story:  none I can see ;-)

--

___
Python tracker 

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



[issue25628] Make namedtuple "verbose" and "rename" parameters into keyword only arguments

2016-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f086d6c9d9f6 by Raymond Hettinger in branch 'default':
Issue #25628:  Make namedtuple "rename" and "verbose" parameters keyword-only.
https://hg.python.org/cpython/rev/f086d6c9d9f6

--
nosy: +python-dev

___
Python tracker 

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



[issue27726] ctags -t does not exists in Makefile.pre.in

2016-08-16 Thread Evelyn Mitchell

Changes by Evelyn Mitchell :


--
nosy:  -Evelyn Mitchell

___
Python tracker 

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



[issue27727] Update Tools/freeze to use .vcxproj files

2016-08-16 Thread Evelyn Mitchell

Changes by Evelyn Mitchell :


--
nosy:  -Evelyn Mitchell

___
Python tracker 

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



[issue27727] Update Tools/freeze to use .vcxproj files

2016-08-16 Thread Decorater

Decorater added the comment:

Not to mention some parts in the ini references zlib in PCBuild which is no 
longer in that folder.

--

___
Python tracker 

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



[issue27727] Update Tools/freeze to use .vcxproj files

2016-08-16 Thread Decorater

Decorater added the comment:

I see 2 files that references dsp files and those are 
Tools/freeze/extensions_win32.ini and Tools/freeze/checkextensions_win32.py.

--
nosy: +Decorater

___
Python tracker 

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



[issue27778] PEP 524: Add os.getrandom()

2016-08-16 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch adds os.getrandom(): thin wrapper on the Linux getrandom() 
syscall.

os.getrandom() can return less bytes than requested.

The patch is incomplete: it doesn't include documentation.

I chose to not implement a loop to not loose entropy if a following call fails 
(ex: fail with EINTR). Rationale:
https://mail.python.org/pipermail/security-sig/2016-July/72.html

We should also add Solaris support later.

See also #27776: "PEP 524: Make os.urandom() blocking on Linux".

--
components: Library (Lib)
files: getrandom.patch
keywords: patch
messages: 272867
nosy: haypo
priority: normal
severity: normal
status: open
title: PEP 524: Add os.getrandom()
type: security
versions: Python 3.6
Added file: http://bugs.python.org/file44127/getrandom.patch

___
Python tracker 

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



[issue27727] Update Tools/freeze to use .vcxproj files

2016-08-16 Thread Kaeptm Blaubaer

Kaeptm Blaubaer added the comment:

Yes, it is an Windows issue.

--

___
Python tracker 

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



[issue27776] PEP 524: Make os.urandom() blocking on Linux

2016-08-16 Thread STINNER Victor

STINNER Victor added the comment:

Patch to make os.urandom() blocking on Linux 3.17+, but use non-blocking 
urandom in _random.Random constructor and _random.Random.seed() with no seed is 
set.

--
keywords: +patch
Added file: http://bugs.python.org/file44126/urandom_nonblock.patch

___
Python tracker 

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



[issue27776] PEP 524: Make os.urandom() blocking on Linux

2016-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 86d0d74bc2e1 by Victor Stinner in branch 'default':
Issue #27776: Cleanup random.c
https://hg.python.org/cpython/rev/86d0d74bc2e1

New changeset ad141164c792 by Victor Stinner in branch 'default':
Issue #27776: dev_urandom(raise=0) now closes the file descriptor on error
https://hg.python.org/cpython/rev/ad141164c792

--

___
Python tracker 

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



[issue24379] Add operator.subscript as a convenience for creating slices

2016-08-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> We should open a separate issue for leaks in objects with empty __slots__

The leak should be fixed first rather than introducing stub fields hack.

--

___
Python tracker 

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



[issue27611] test_tix cannot import _default_root after test_idle

2016-08-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This issue is about test_tix failing when run after test_idle, due to the 
conjunction of two specific causes, one old (tix importing _default_root), one 
new (IDLE deleting and not restoring _default_root).  The new cause exposed the 
old.  Fixing either cause would have negated the conjunction, but at Zack's 
urging, I fixed both.  I even did one extra bit of cleanup in moving the 
tkinter and os imports to the top where they belong.  In my view, my patch was 
more than complete and this issue is fixed and should have remained closed and 
should be reclosed.

Serhiy, when I wrote the tix patch, I was aware that tix remains buggy in that 
it will fail if a *user* imports tix, removes _default_root, and calls either 
of the functions that unconditionally access the attribute.  Since test_tix 
only tests that the tix can be imported and that tix.Tk runs, there may be more 
bugs.  And more cleanups might be needed.  However, patching tix to work better 
is a different issue than this one.  If you want, open a new issue, add some 
tests, and write the patch you outlined.

--
assignee: terry.reedy -> 

___
Python tracker 

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



[issue24853] Py_Finalize doesn't clean up PyImport_Inittab

2016-08-16 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue27611] test_tix cannot import _default_root after test_idle

2016-08-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

DisplayStyle() fails with AttributeError after NoDefaultRoot(). Should be made 
following changes:

1. The refwindow option should have priority over _default_root.
2. Add the master keyword-only parameter for creating styles without refwindow 
(3.6 only).

--

___
Python tracker 

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



[issue27594] Assertion failure when running "test_ast" tests with coverage.

2016-08-16 Thread ap

ap added the comment:

Thanks, Ivan, that change fixes it for me, too.

I checked with a more recent revision and build:

$ hg identify
265644bad99e+ tip
$ ./python.exe --version
Python 3.6.0a4+
$ 

Confirmed that it still exhibited the same behaviour as before:

$ ./python.exe -m test test_ast
Run tests sequentially
0:00:00 [1/1] test_ast
1 test OK.
Total duration: 0:00:06
$ 

$ ./python.exe -m test --coverage -D`pwd`/coverage_data test_ast
Run tests sequentially
0:00:00 [1/1] test_ast
Assertion failed: (line > 0), function _PyCode_CheckLineNumber, file 
Objects/codeobject.c, line 717.
Fatal Python error: Aborted

Current thread 0x7fff7b5a7000 (most recent call first):
  File "test", line 0 in 
  File "/python-dev/cpython/Lib/test/test_ast.py", line 559 in 
test_level_as_none
  File "/python-dev/cpython/Lib/unittest/case.py", line 600 in run
  File "/python-dev/cpython/Lib/unittest/case.py", line 648 in __call__
  File "/python-dev/cpython/Lib/unittest/suite.py", line 122 in run
  File "/python-dev/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/python-dev/cpython/Lib/unittest/suite.py", line 122 in run
  File "/python-dev/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/python-dev/cpython/Lib/unittest/suite.py", line 122 in run
  File "/python-dev/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/python-dev/cpython/Lib/test/support/__init__.py", line 1709 in run
  File "/python-dev/cpython/Lib/test/support/__init__.py", line 1810 in 
_run_suite
  File "/python-dev/cpython/Lib/test/support/__init__.py", line 1844 in 
run_unittest
  File "/python-dev/cpython/Lib/test/libregrtest/runtest.py", line 179 in 
test_runner
  File "/python-dev/cpython/Lib/test/libregrtest/runtest.py", line 180 in 
runtest_inner
  File "/python-dev/cpython/Lib/test/libregrtest/runtest.py", line 144 in 
runtest
  File "", line 1 in 
  File "/python-dev/cpython/Lib/trace.py", line 469 in runctx
  File "/python-dev/cpython/Lib/test/libregrtest/main.py", line 330 in 
run_tests_sequential
  File "/python-dev/cpython/Lib/test/libregrtest/main.py", line 406 in run_tests
  File "/python-dev/cpython/Lib/test/libregrtest/main.py", line 466 in _main
  File "/python-dev/cpython/Lib/test/libregrtest/main.py", line 446 in main
  File "/python-dev/cpython/Lib/test/libregrtest/main.py", line 508 in main
  File "/python-dev/cpython/Lib/test/__main__.py", line 2 in 
  File "/python-dev/cpython/Lib/runpy.py", line 85 in _run_code
  File "/python-dev/cpython/Lib/runpy.py", line 184 in _run_module_as_main
Abort trap: 6
$ 

I applied the change you suggested, and this was the result:

$ ./python.exe -m test --coverage -D`pwd`/coverage_data test_ast
Run tests sequentially
0:00:00 [1/1] test_ast
1 test OK.
lines   cov%   module   (path)
  556 1%   _collections_abc   (/python-dev/cpython/Lib/_collections_abc.py)
  14725%   _weakrefset   (/python-dev/cpython/Lib/_weakrefset.py)
   9616%   abc   (/python-dev/cpython/Lib/abc.py)
  15666%   ast   (/python-dev/cpython/Lib/ast.py)
  418 1%   codecs   (/python-dev/cpython/Lib/codecs.py)
  692 0%   collections.__init__   
(/python-dev/cpython/Lib/collections/__init__.py)
  166 8%   contextlib   (/python-dev/cpython/Lib/contextlib.py)
  31822%   dis   (/python-dev/cpython/Lib/dis.py)
   74 5%   genericpath   (/python-dev/cpython/Lib/genericpath.py)
  103 2%   importlib.__init__   
(/python-dev/cpython/Lib/importlib/__init__.py)
 1776 0%   inspect   (/python-dev/cpython/Lib/inspect.py)
 1228 0%   locale   (/python-dev/cpython/Lib/locale.py)
  170 0%   multiprocessing.process   
(/python-dev/cpython/Lib/multiprocessing/process.py)
  612 1%   os   (/python-dev/cpython/Lib/os.py)
  687 0%   platform   (/python-dev/cpython/Lib/platform.py)
  313 5%   posixpath   (/python-dev/cpython/Lib/posixpath.py)
  435 1%   sysconfig   (/python-dev/cpython/Lib/sysconfig.py)
  336 1%   test.libregrtest.main   
(/python-dev/cpython/Lib/test/libregrtest/main.py)
  17429%   test.libregrtest.runtest   
(/python-dev/cpython/Lib/test/libregrtest/runtest.py)
  19727%   test.libregrtest.save_env   
(/python-dev/cpython/Lib/test/libregrtest/save_env.py)
 1341 3%   test.support.__init__   
(/python-dev/cpython/Lib/test/support/__init__.py)
  87098%   test.test_ast   (/python-dev/cpython/Lib/test/test_ast.py)
  461 0%   trace   (/python-dev/cpython/Lib/trace.py)
  285 2%   traceback   (/python-dev/cpython/Lib/traceback.py)
  82420%   unittest.case   (/python-dev/cpython/Lib/unittest/case.py)
  329 8%   unittest.loader   (/python-dev/cpython/Lib/unittest/loader.py)
  13420%   unittest.result   (/python-dev/cpython/Lib/unittest/result.py)
  22244%   unittest.suite   (/python-dev/cpython/Lib/unittest/suite.py)
  134 0%   unittest.util   (/python-dev/cpython/Lib/unittest/util.py)
  384 6%   weakref   (/python-dev/cpython/Lib/weakref.py)
Total duration: 0:00:09
$

--


[issue27777] cgi.FieldStorage can't parse simple body with Content-Length and no Content-Disposition

2016-08-16 Thread Decorater

Decorater added the comment:

Here is a patch to review (note I only had disc space to clone 3.6 so I had to 
manually download this version of the file).

--
Added file: http://bugs.python.org/file44125/cgi.py

___
Python tracker 

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



[issue27777] cgi.FieldStorage can't parse simple body with Content-Length and no Content-Disposition

2016-08-16 Thread Decorater

Decorater added the comment:

hmm into looking it should check if it is in actuality a binary file the length 
of the file data does not really determine anything on encoding really.

if self._binary_file:

would suffice on determining binary mode or not.

--
nosy: +Decorater

___
Python tracker 

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



[issue27777] cgi.FieldStorage can't parse simple body with Content-Length and no Content-Disposition

2016-08-16 Thread rr-

New submission from rr-:

Sending requests with Content-Length but without Content-Disposition headers 
causes following error:

Traceback (most recent call last):
  File "./test", line 19, in 
form = cgi.FieldStorage(fp=env['wsgi.input'], environ=env)
  File "/usr/lib/python3.5/cgi.py", line 561, in __init__
self.read_single()
  File "/usr/lib/python3.5/cgi.py", line 740, in read_single
self.read_binary()
  File "/usr/lib/python3.5/cgi.py", line 762, in read_binary
self.file.write(data)
TypeError: write() argument must be str, not bytes

I've attached a test file that reproduces the issue.

The issue is because read_single decides whether to read the content as binary 
or text depending on content-length - if it's > 0, it uses read_binary which 
assumes binary input, and rewrites this input to self.file, assuming self.file 
is opened in binary mode.

At the same, self.file is opened in text mode, because self._binary_file is set 
to False, which in turn is because there's no Content-Disposition header.

At very least, the decision whether to use binary or text should be consistent 
in both places (self.length >= 0 vs self._binary_file).

Related: https://bugs.python.org/issue27308
Note that unlike https://bugs.python.org/issue24764 this issue does NOT concern 
multipart requests.

--
components: Library (Lib)
files: test
messages: 272856
nosy: rr-
priority: normal
severity: normal
status: open
title: cgi.FieldStorage can't parse simple body with Content-Length and no 
Content-Disposition
versions: Python 3.5
Added file: http://bugs.python.org/file44124/test

___
Python tracker 

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



[issue27776] PEP 524: Make os.urandom() blocking on Linux

2016-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 980e2c781810 by Victor Stinner in branch 'default':
Issue #27776: Cleanup random.c
https://hg.python.org/cpython/rev/980e2c781810

New changeset 265644bad99e by Victor Stinner in branch 'default':
Issue #27776: _PyRandom_Init() doesn't call PyErr_CheckSignals() anymore
https://hg.python.org/cpython/rev/265644bad99e

--
nosy: +python-dev

___
Python tracker 

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



[issue27775] `shlex.split(None)` causes infinite loop

2016-08-16 Thread R. David Murray

R. David Murray added the comment:

This is working as designed.  None means read from stdin.  It is already 
documented in a note under shlex.split, so there isn't a doc issue here either. 

(Aside: 'crash' means segfault, which this isn't.)

You could try to recast this as a feature request, but I think backward 
compatibility would shoot that down.  You could raise it on python-ideas if you 
want to, but it is quite likely that *someone* is using this feature, so I 
don't think it likely we'll want to change it.

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

___
Python tracker 

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



[issue27734] Memory leaks at Python35-32

2016-08-16 Thread R. David Murray

Changes by R. David Murray :


--
superseder:  -> PEP 3121, 384 Refactoring

___
Python tracker 

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



[issue27776] PEP 524: Make os.urandom() blocking on Linux

2016-08-16 Thread Decorater

Decorater added the comment:

Wow. ( linux only pep? inb4 a windows thing gets wedged in)

--
nosy: +Decorater

___
Python tracker 

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



[issue27776] PEP 524: Make os.urandom() blocking on Linux

2016-08-16 Thread STINNER Victor

New submission from STINNER Victor:

Issue to track the implementation of the PEP 524.

--
messages: 272852
nosy: haypo
priority: normal
severity: normal
status: open
title: PEP 524: Make os.urandom() blocking on Linux
type: security
versions: Python 3.6

___
Python tracker 

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



[issue27734] Memory leaks at Python35-32

2016-08-16 Thread Stefan Krah

Stefan Krah added the comment:

#15787. All Python versions have these leaks, which aren't terribly important 
in practice.

If it still bothers you, consider writing a Python C extension instead of 
"embedding" Python, which is what most people do anyway.

--
status: open -> closed

___
Python tracker 

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



[issue27643] test_ctypes fails on AIX with xlc

2016-08-16 Thread Michael Felt

Michael Felt added the comment:

On 8/4/2016 10:58 AM, Martin Panter wrote:
> Can you figure out a way to test for XLC (but not GCC, which the AIX buildbot 
> uses), and then try my patch out? Hopefully you see no more compiler 
> warnings, test_ints() should now pass, and test_shorts() should be skipped.

Was not as simple as it sounds. I could not find a specific parameter 
provided by xlc and as you wanted something that would only skip on AIX 
- testing for __GNUC__ (in the positive sense) will not work either.

What I am thinking of now is

#if defined(__GNUC__) || !defined(_AIX)

...

#endif

As this will pass on AIX when GCC is used, but only be skipped on AIX 
when GCC is not used.

+ More TESTS 

Summary - maybe the problem is with the "byref()" routine...

++

My initial test of the patch confused me, so I went back to the original 
code - and started again.

I have three partitions I am testing on - x064 (AIX 5.3 TL7, vac v.11); 
x065 (AIX 5.3 TL7, gcc 4.7.4),
and x067 ( Debian 3.16.7-ckt9-3 (2015-04-23) ppc64, gcc (Debian 
5.3.1-21) 5.3.1 20160528)

My working directory is /data/prj/aixtools/python/python-2.7.12.0 which 
is a copy of the extracted Python-2.7.12.
This directory is on NFS, so each system is using the same files as source:

The first builds - no changes - expect to test_bitfields.py:

##for n in "ABCDEFGHIMNOPQRS":
##print n, hex(getattr(BITS, n).size), getattr(BITS, n).offset
for n in "ABCDEFGHIMNOPQRS":
 b = BITS()
 print n, hex(getattr(BITS, n).size), getattr(BITS, n).offset, 
func(byref(b), n)

x065:
root@x065:[/data/prj/aixtools/python/python-2.7.12.0]./python 
Lib/ctypes/test/test_bitfields.py
A 0x1001f 0 0
B 0x2001d 0 0
C 0x3001a 0 0
D 0x40016 0 0
E 0x50011 0 0
F 0x6000b 0 0
G 0x70004 0 0
H 0x80018 4 0
I 0x9000f 4 0
M 0x1000e 6 0
N 0x2000c 6 0
O 0x30009 6 0
P 0x40005 6 0
Q 0x5 6 0
R 0x6000a 8 0
S 0x70003 8 0

root@x067:/data/prj/aixtools/python/python-2.7.12.0# ./python 
Lib/ctypes/test/test_bitfields.py
A 0x1001f 0 0
B 0x2001d 0 0
C 0x3001a 0 0
D 0x40016 0 0
E 0x50011 0 0
F 0x6000b 0 0
G 0x70004 0 0
H 0x80018 4 0
I 0x9000f 4 0
M 0x1000e 6 0
N 0x2000c 6 0
O 0x30009 6 0
P 0x40005 6 0
Q 0x5 6 0
R 0x6000a 8 0
S 0x70003 8 0
...
--
Ran 19 tests in 0.087s

OK

root@x064:[/data/prj/aixtools/python/python-2.7.12.0]./python 
Lib/ctypes/test/test_bitfields.py
A 0x1001f 0 0
B 0x2001d 0 0
C 0x3001a 0 0
D 0x40016 0 0
E 0x50011 0 0
F 0x6000b 0 0
G 0x70004 0 0
H 0x80018 4 0
I 0x9000f 4 0
M 0x1000e 6 0
N 0x2000c 6 0
O 0x30009 6 0
P 0x40005 6 0
Q 0x5 6 0
R 0x6000a 8 0
S 0x70003 8 0
.FF
==
FAIL: test_ints (__main__.C_Test)
--
Traceback (most recent call last):
   File "Lib/ctypes/test/test_bitfields.py", line 45, in test_ints
 self.assertEqual((name, i, getattr(b, name)), (name, i, 
func(byref(b), name)))
AssertionError: Tuples differ: ('A', 1, -1) != ('A', 1, 1)

First differing element 2:
-1
1

- ('A', 1, -1)
?  -

+ ('A', 1, 1)

==
FAIL: test_shorts (__main__.C_Test)
--
Traceback (most recent call last):
   File "Lib/ctypes/test/test_bitfields.py", line 52, in test_shorts
 self.assertEqual((name, i, getattr(b, name)), (name, i, 
func(byref(b), name)))
AssertionError: Tuples differ: ('M', 1, -1) != ('M', 1, 1)

First differing element 2:
-1
1

- ('M', 1, -1)
?  -

+ ('M', 1, 1)

--
Ran 19 tests in 0.010s

FAILED (failures=2)
root@x064:[/data/prj/aixtools/python/python-2.7.12.0]

Changed the test again to include:
##for n in "ABCDEFGHIMNOPQRS":
##print n, hex(getattr(BITS, n).size), getattr(BITS, n).offset
for n in "ABCDEFGHIMNOPQRS":
 b = BITS()
 print n, hex(getattr(BITS, n).size), getattr(BITS, n).offset, 
getattr(b,n), func(byref(b), n)

root@x064:[/data/prj/aixtools/python/python-2.7.12.0]./python 
Lib/ctypes/test/test_bitfields.py
A 0x1001f 0 0 0
B 0x2001d 0 0 0
C 0x3001a 0 0 0
D 0x40016 0 0 0
E 0x50011 0 0 0
F 0x6000b 0 0 0
G 0x70004 0 0 0
H 0x80018 4 0 0
I 0x9000f 4 0 0
M 0x1000e 6 0 0
N 0x2000c 6 0 0
O 0x30009 6 0 0
P 0x40005 6 0 0
Q 0x5 6 0 0
R 0x6000a 8 0 0
S 0x70003 8 0 0
.FF
==
FAIL: test_ints (__main__.C_Test)
--
Traceback (most recent call last):
   File "Lib/ctypes/test/test_bitfields.py", line 45, in test_ints
 self.assertEqual((name, i, getattr(b, name)), (name, i, 
func(byref(b), name)))

[issue27038] Make os.DirEntry exist

2016-08-16 Thread STINNER Victor

STINNER Victor added the comment:

Brendan Moloney: Please open a thread on the python-ideas mailing list to 
discuss your idea. Please don't start discussing on a *closed* issue: since an 
issue is closed, it's hidden from the main bug tracker and so only very few 
people see it.

--

___
Python tracker 

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



[issue27645] Supporting native backup facility of SQLite

2016-08-16 Thread Lele Gaifax

Lele Gaifax added the comment:

I guess the chance of getting this merged before the 3.6 betas is very low, but 
if there is *anything* I could do to raise it, please tell :-)

--

___
Python tracker 

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



[issue27775] `shlex.split(None)` causes infinite loop

2016-08-16 Thread Ram Rachum

New submission from Ram Rachum:

I had a code that would freeze, and after debugging I realized that a bug in my 
code caused `shlex.split(None)` to be called, which puts Python in an infinite 
loop.

We probably want to do an `if not isinstance(s, ...): raise TypeError('Bla 
bla')` at the start of the `shlex` function, or maybe at `shlex.__init__`, or 
maybe both.

What bothers me though, is that it seems that shlex can accept both a string 
and a stream, so we should allow both of these and not others. Now, I don't 
know how to check whether it's a proper stream. Would `isinstance(s, 
io.IOBase)` be good enough? Will it catch all of the streams that people might 
use in `shlex.split`?

(Also, I recently proposed something related in python-ideas: 
https://groups.google.com/forum/#!searchin/python-ideas/stream%7Csort:relevance/python-ideas/uYlnnH52VEA/PSHkQRtaBwAJ
 )

--
components: Library (Lib)
messages: 272847
nosy: cool-RR
priority: normal
severity: normal
status: open
title: `shlex.split(None)` causes infinite loop
type: crash
versions: Python 3.6

___
Python tracker 

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



[issue27611] test_tix cannot import _default_root after test_idle

2016-08-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

What do you mean by 'does not work' and what did I omit?

--

___
Python tracker 

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



[issue27768] ssl: add public API for IA-32 processor capabilities vector

2016-08-16 Thread Gregory P. Smith

Gregory P. Smith added the comment:

This is very architecture specific and focused on low level information that 
you can also already get from places like /proc/cpuinfo on Linux.

Also, regardless of what capability bits a CPU exposes that has nothing to do 
with what accelerations the underlying library implementation itself actually 
supports.

For your example purpose of choosing which algorithm to use, testing the actual 
performance of each option in your code at startup time seems more foolproof in 
any application running long enough for performance to be an issue.

I expect in most common situations you can just use ctypes to call this 
function from openssl if you feel you must use it.

I'm not convinced it belongs in the stdlib.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue27611] test_tix cannot import _default_root after test_idle

2016-08-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Terry, you committed not full patch. The tix module still doesn't work after 
NoDefaultRoot().

--
status: closed -> open

___
Python tracker 

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



[issue6143] IDLE - an extension to clear the shell window

2016-08-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Comments on taleinat.20140219.IDLE_ClearWindow_extension.patch.

In 3.6, module names are lowercase, not too long.  Also, I am trying to 
consolidate small files, not multiply them.

I am trying to convert existing built-in extensions to built-in features, not 
add new extension files. 

The options menu seems like a strange place for the menu item.  Since this 
patch is for Shell, I would put it on the Shell menu.  Select All == Control A 
(Edit menu) + Backspace or Delete clears editor and output windows. (I could 
add this to the doc.)  The issue with Shell, as Roger noted in his original 
post, is the current mechanism to prevent deletion.

This suggests an alternate solution: only protect the current prompt (which I 
would like to move to a sidebar anyway).  There could be an option to making 
Shell history editable or not?  Why should people have to save-load or 
copy-paste to edit a shell session?  (Currently, the Rt click context menu 
displays an apparently active 'Cut' that does not work.)  The main issue is 
that people might edit past input, hit return, and expect the code to run.  
This could be made to work.  

What to delete?  Everything prior to last prompt is plausible when IDLE is 
paused waiting for code input.  It is wrong if one is trying to stop output 
since the last prompt.  These are two different use cases (Raymond mentioned 
both in duplicate #27771).

1. Cosmetic cleanup of a long session.  A Shell => Clear (everything) and 
Restart (and emit a new prompt) would work for this.

2. Recovery from excessively many or long lines.  (see #27750, for instance).  
For this, one may only want to delete the most recent program output (and 
ignore anything that keeps coming before the next prompt is printed).  The need 
here is for Shell to remain more responsive than it currently does.

Undo-able?  Cntl-A + delete is already undo-able.  Clear and Restart would be, 
as Restart clears the undo stack.  I think emergency deletion should not be.

--
assignee: roger.serwy -> terry.reedy
stage:  -> needs patch
versions: +Python 3.6 -Python 2.7, 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



[issue26750] Mock autospec does not work with subclasses of property()

2016-08-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3ff02380b1bf by Gregory P. Smith in branch '3.5':
Issue #26750: use inspect.isdatadescriptor instead of our own
https://hg.python.org/cpython/rev/3ff02380b1bf

New changeset d51a66622266 by Gregory P. Smith in branch 'default':
Issue #26750: use inspect.isdatadescriptor instead of our own
https://hg.python.org/cpython/rev/d51a66622266

--

___
Python tracker 

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



[issue27750] Idle Shell freezes when printing 100000+ char lines.

2016-08-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

200 (lines) * 200 (columns) * 3 (or more chars/item) = line with 12+ chars 
-- which you try to print 200 times.  This is known to mostly freeze tk Text 
windows.  This was not a crash for me, as I was able to close Shell and 
continue.

PS: Please post uncompressed files next time.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> IDLE shell window gets very slow when displaying long lines
title: Idle editor crashes when input size more than 250 lines given -> Idle 
Shell freezes when printing 10+ char lines.

___
Python tracker 

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



[issue1442493] IDLE shell window gets very slow when displaying long lines

2016-08-16 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
assignee:  -> terry.reedy

___
Python tracker 

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



[issue11566] hypot define in pyconfig.h clashes with g++'s cmath

2016-08-16 Thread Petri Lehtinen

Changes by Petri Lehtinen :


--
nosy:  -petri.lehtinen

___
Python tracker 

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



[issue27714] some test_idle tests are not re-runnable, producing false failures with regrtest -w option

2016-08-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I fixed #27611.  Could you try the comment out test of macosx call for 
test_autocomplete (around line 30 to 35) in 2.7 and 3.5?  If those also pass, I 
will patch all three and close this.

--

___
Python tracker 

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