[issue22636] avoid using a shell in ctypes.util: replace os.popen with subprocess

2016-06-09 Thread STINNER Victor

STINNER Victor added the comment:

Maybe the failure should be explained in a comment? (Sorry I din't read the
patch.)

--

___
Python tracker 

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



[issue15657] Error in Python 3 docs for PyMethodDef

2016-06-09 Thread Berker Peksag

Berker Peksag added the comment:

I'm going to delete

(but note that :const:`METH_KEYWORDS` alone is equivalent to ``METH_VARARGS 
| METH_KEYWORDS``)

from Doc/c-api/structures.rst in 3.5.

Then change the value of METH_KEYWORDS from 0x0002 to 0x0003 in 3.6.

Thanks for the review Serhiy.

--
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue16484] pydoc generates invalid docs.python.org link for xml.etree.ElementTree and other modules

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Kaushik or David (or anyone else), does you have an idea of how to fix the 
Windows tests? It would be good to make the buildbots healthy again, then it is 
easier to see new failures in Windows.

--
priority: normal -> high

___
Python tracker 

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



[issue27243] __aiter__ should return async iterator instead of awaitable

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Test suite emits a new warning, and fails under python -Werror:

==
ERROR: test_readline (test.test_asyncio.test_pep492.StreamReaderTests)
--
Traceback (most recent call last):
  File 
"/media/disk/home/proj/python/cpython/Lib/test/test_asyncio/test_pep492.py", 
line 89, in test_readline
data = self.loop.run_until_complete(reader())
  File "/media/disk/home/proj/python/cpython/Lib/asyncio/base_events.py", line 
387, in run_until_complete
return future.result()
  File "/media/disk/home/proj/python/cpython/Lib/asyncio/futures.py", line 274, 
in result
raise self._exception
  File "/media/disk/home/proj/python/cpython/Lib/asyncio/tasks.py", line 239, 
in _step
result = coro.send(None)
  File 
"/media/disk/home/proj/python/cpython/Lib/test/test_asyncio/test_pep492.py", 
line 85, in reader
async for line in stream:
PendingDeprecationWarning: 'StreamReader' implements legacy __aiter__ protocol; 
__aiter__ should return an asynchronous iterator, not awaitable

--
nosy: +martin.panter
status: closed -> open

___
Python tracker 

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



[issue26868] Document PyModule_AddObject's behavior on error

2016-06-09 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the review Serhiy. Here is an updated patch.

--
Added file: http://bugs.python.org/file43328/issue26868_v2.diff

___
Python tracker 

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



[issue22636] avoid using a shell in ctypes.util: replace os.popen with subprocess

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Yes it is okay. The code is compiling a dummy file without main(), just to see 
what libraries GCC tries to link with it. It is only interested in extracting 
the line matching *libc.so.*, which in your case should be

/lib/i386-linux-gnu/libc.so.6

So you should find that ctypes.util._findLib_gcc("c") still returns this path, 
even though the compile command technically fails.

--

___
Python tracker 

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



[issue5124] IDLE - pasting text doesn't delete selection

2016-06-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I presume then that the tests pass on Linux with TEntry removed.  I take this 
as repudiation of the 'X11' behavior by the tk maintainers, and as support for 
changing the old widgets.  Having different paste behavior in text and entry 
widgets, or even different entry widgets (in the same release of IDLE, when 
some but not all 'Entry's have been converted) would be pretty bad.

--

___
Python tracker 

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



[issue22636] avoid using a shell in ctypes.util: replace os.popen with subprocess

2016-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It looks to me that the command used in _findLib_gcc always fails.

$ LANG=C LC_ALL=C gcc -Wl,-t -o ttt -lc
/usr/bin/ld: mode elf_i386
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/crt1.o
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/crti.o
/usr/lib/gcc/i686-linux-gnu/5/crtbegin.o
/lib/i386-linux-gnu/libc.so.6
(/usr/lib/i386-linux-gnu/libc_nonshared.a)elf-init.oS
/lib/i386-linux-gnu/ld-linux.so.2
/lib/i386-linux-gnu/ld-linux.so.2
-lgcc_s (/usr/lib/gcc/i686-linux-gnu/5/libgcc_s.so)
/lib/i386-linux-gnu/libc.so.6
/lib/i386-linux-gnu/ld-linux.so.2
-lgcc_s (/usr/lib/gcc/i686-linux-gnu/5/libgcc_s.so)
/usr/lib/gcc/i686-linux-gnu/5/crtend.o
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/crtn.o
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/crt1.o: In function 
`_start':
(.text+0x18): undefined reference to `main'
/usr/bin/ld: link errors found, deleting executable `ttt'
collect2: error: ld returned 1 exit status

Is it OK?

--

___
Python tracker 

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



[issue20508] IndexError from ipaddress._BaseNetwork.__getitem__ has no message

2016-06-09 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue24617] os.makedirs()'s [mode] not correct

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

This version of the patch looks good to me

--
stage: patch review -> commit review

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Will try to change the existing code from os.popen to subprocess (Issue 26439) 
to set a better example for new code like this

--
dependencies: +avoid using a shell in ctypes.util: replace os.popen with 
subprocess

___
Python tracker 

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



[issue5124] IDLE - pasting text doesn't delete selection

2016-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I deliberately omitted ttk.Entry, because it doesn't have special behavior on 
X11.

--

___
Python tracker 

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



[issue24750] IDLE: Cosmetic improvements for main window

2016-06-09 Thread Terry J. Reedy

Changes by Terry J. Reedy :


Added file: http://bugs.python.org/file43327/ttk-scrollbar.diff

___
Python tracker 

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



[issue27239] Make idlelib.macosx self-contained.

2016-06-09 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

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



[issue22636] avoid using a shell in ctypes.util: replace os.popen with subprocess

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Updated Python 2 patch merged with recent changes.

I will commit at least the Python 3 version soon, because the existing code 
sets a bad example for potential additions (Issue 26439).

--
Added file: http://bugs.python.org/file43326/ctypes_util_popen-4.py2.patch

___
Python tracker 

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



[issue20508] IndexError from ipaddress._BaseNetwork.__getitem__ has no message

2016-06-09 Thread Berker Peksag

Berker Peksag added the comment:

+1 for "address index out of range". The current test only covers the first 
IndexError. We also need to add another one for the else branch.

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



[issue26565] [ctypes] Add value attribute to non basic pointers.

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Eryk Sun’s as_void suggestion sounds similar to doing:

ctypes.cast(any_pointer, ctypes.c_void_p)

Why do you want the address? Perhaps it is good enough to get it from a void 
pointer:

ctypes.cast(any_pointer, ctypes.c_void_p).value

Maybe “pointer_value” would be less confusing than “toaddress”.

--
nosy: +martin.panter

___
Python tracker 

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



[issue7356] parsing of ldconfig output in ctypes/utils.py depends on the locale

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b4839797f482 by Matthias Klose in branch '2.7':
Issue #7356: ctypes.util: Make parsing of ldconfig output locale independent.
https://hg.python.org/cpython/rev/b4839797f482

--
nosy: +python-dev

___
Python tracker 

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



[issue7356] parsing of ldconfig output in ctypes/utils.py depends on the locale

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

This was supposed to be fixed in 2.7 by r78979 and beb9d176503e. But those 
changes were made to the dead _findLib_ldconfig() function (later deleted as 
part of Issue 13979). I will port the changes to the live 
_findSoname_ldconfig() function.

--
nosy: +martin.panter

___
Python tracker 

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



[issue8491] Need readline command and keybinding information

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

For the record, I removed some trailing spaces and reworded the link in the 
comitted version.

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

___
Python tracker 

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



[issue24750] IDLE: Cosmetic improvements for main window

2016-06-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Revised plan: use ttk in 3.6 and only 3.6.  I will revise scroll patch for new 
file names, retest, and apply if good.

--
assignee:  -> terry.reedy
stage: needs patch -> commit 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



[issue24759] Idle: require tk 8.5 and ttk widgets, and drop unneeded code.

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 76f831e4b806 by Terry Jan Reedy in branch 'default':
Issue #24759: IDLE requires tk 8.5 and availability ttk widgets.
https://hg.python.org/cpython/rev/76f831e4b806

--

___
Python tracker 

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



[issue24759] Idle: require tk 8.5 and ttk widgets, and drop unneeded code.

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 81927f86fa3a by Terry Jan Reedy in branch 'default':
Issue #24759: Add test for IDLE syntax colorizoer.
https://hg.python.org/cpython/rev/81927f86fa3a

--

___
Python tracker 

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



[issue8491] Need readline command and keybinding information

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e981a4273cf6 by Martin Panter in branch '2.7':
Issue #8491: Add link to Gnu Readline configuration documentation
https://hg.python.org/cpython/rev/e981a4273cf6

New changeset 5bbb021450d7 by Martin Panter in branch '3.5':
Issue #8491: Add link to Gnu Readline configuration documentation
https://hg.python.org/cpython/rev/5bbb021450d7

New changeset 5b904920c2d1 by Martin Panter in branch 'default':
Issue #8491: Merge readline doc from 3.5
https://hg.python.org/cpython/rev/5b904920c2d1

--
nosy: +python-dev

___
Python tracker 

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



[issue15476] Index "code object" and link to code object definition

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Thanks for the patch Tommy. I think we can close this now.

--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed

___
Python tracker 

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



[issue27186] add os.fspath()

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cec1f00c538d by Brett Cannon in branch 'default':
Issue #27186: Document PyOS_FSPath().
https://hg.python.org/cpython/rev/cec1f00c538d

--

___
Python tracker 

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



[issue26556] Update expat to 2.2.1

2016-06-09 Thread Brian Martin

Brian Martin added the comment:

Per http://expat.sourceforge.net/, version 2.1.1 fixes CVE-2015-1283, not 2.2.1 
as mentioned in a comment.

--
nosy: +Brian Martin

___
Python tracker 

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



[issue15476] Index "code object" and link to code object definition

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2e9aace7e10a by Tommy Beadle in branch '3.5':
[Issue 15476] Make "code object" its own entry in the index
https://hg.python.org/cpython/rev/2e9aace7e10a

New changeset 8455bbc6b4f2 by Martin Panter in branch 'default':
Issue #15476: Merge index entries from 3.5
https://hg.python.org/cpython/rev/8455bbc6b4f2

New changeset f89e96235a42 by Tommy Beadle in branch '2.7':
[Issue 15476] Make "code object" its own entry in the index
https://hg.python.org/cpython/rev/f89e96235a42

--
nosy: +python-dev

___
Python tracker 

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



[issue23693] timeit accuracy could be better

2016-06-09 Thread STINNER Victor

STINNER Victor added the comment:

Hi,

I develop a new implementation of timeit which should be more reliable:
http://perf.readthedocs.io/en/latest/

* Run 25 processes instead of just 1
* Compute average and standard deviation rather than the minimum
* Don't disable the garbage collector
* Skip the first timing to "warmup" the benchmark

Using the minimum and disable the garbage collector is a bad practice, it is 
not reliable:

* multiple processes are need to test different random hash functions, since 
Python hash function is now randomized by default in Python 3
* Linux also randomizes the address space by default (ASLR) and so the exact 
timing of memory accesses is different in each process

My following blog post "My journey to stable benchmark, part 3 (average)" 
explains in depth the multiple issues of using the minimum:
https://haypo.github.io/journey-to-stable-benchmark-average.html

My perf module is very yound, it's still a work-in-progress. It should be 
better than timeit right now. It works on Python 2.7 and 3 (I tested 3.4).

We may pick the best ideas into the timeit module.

See also my article explaining how to tune Linux to reduce the "noise" of the 
operating system on microbenchmarks:
https://haypo.github.io/journey-to-stable-benchmark-system.html

--

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-06-09 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon
dependencies: +Add a "What's New" entry for PEP 519

___
Python tracker 

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



[issue27283] Add a "What's New" entry for PEP 519

2016-06-09 Thread Brett Cannon

New submission from Brett Cannon:

Issue to track the fact that I need to write the "What's New" entry once all 
other PEP 519-related work is finished.

--
assignee: brett.cannon
components: Documentation
messages: 268066
nosy: brett.cannon
priority: deferred blocker
severity: normal
stage: needs patch
status: open
title: Add a "What's New" entry for PEP 519
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



[issue27182] PEP 519 support in the stdlib

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6239673d5e1d by Brett Cannon in branch 'default':
Issue #27182: Document os.PathLike.
https://hg.python.org/cpython/rev/6239673d5e1d

--

___
Python tracker 

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



[issue5124] IDLE - pasting text doesn't delete selection

2016-06-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

For 3.6, I added ttk.Entry to x11 fixer.  I expanded tests to Entry and 
Spinboxes.  I noted in a comment that tk.Entry/Spinbox, but not ttk.Entry, 
would not paste with generated <> event without a 0-length selection.  
This might be a glitch in tk, but pasting with line Entry worked fine.  Will 
attach 3.5 and 2.7 patches as well.

The 2.7 test results in ThemeChanged warnings when run as part of test_idle, 
but not when run alone.  I am ignoring this.

I will apply when tests run on x11.

--
Added file: http://bugs.python.org/file43323/x11-paste-36.diff

___
Python tracker 

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



[issue5124] IDLE - pasting text doesn't delete selection

2016-06-09 Thread Terry J. Reedy

Changes by Terry J. Reedy :


Added file: http://bugs.python.org/file43324/x11-paste-35.diff

___
Python tracker 

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



[issue5124] IDLE - pasting text doesn't delete selection

2016-06-09 Thread Terry J. Reedy

Changes by Terry J. Reedy :


Added file: http://bugs.python.org/file43325/x11-paste-27.diff

___
Python tracker 

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



[issue27243] __aiter__ should return async iterator instead of awaitable

2016-06-09 Thread Yury Selivanov

Yury Selivanov added the comment:

I've also updated PEP 492: https://hg.python.org/peps/rev/fef4b9969b9d  

Please feel free to post to this issue if you think that I should have covered 
it differently or in more detail.

--

___
Python tracker 

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



[issue27186] add os.fspath()

2016-06-09 Thread Brett Cannon

Brett Cannon added the comment:

I'm starting to catch up on everything you all did for PEP 519 and I wanted to 
say thanks! It looks like everything that needs to be done has been committed, 
has a patch, or just needs docs. The only thing I needed to do post-commit is 
tweak the docstrings to be PEP 8 compatible and reword some documention and 
docstrings.

--

___
Python tracker 

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



[issue27262] IDLE: move Aqua context menu code to maxosx

2016-06-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am leaving this open to look into later adding an automated test for this to 
the new test_editmenu file that will be added for #5124.

--

___
Python tracker 

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



[issue27186] add os.fspath()

2016-06-09 Thread Brett Cannon

Brett Cannon added the comment:

Re-opening as there are several patches that got put in here that have not been 
applied (e.g. glossary entry, os.DirEntry, etc.).

--
assignee:  -> brett.cannon
status: closed -> open

___
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-06-09 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka added the comment:
> See issue27213. Maybe fast call with keyword arguments would avoid the 
> creation of a dict.

In a first verison of my implementation, I used dictionary items
stored a a list of (key, value) tuples in the same PyObject* C array
than positional parameters.

But in practice, it's very rare in the C code base to have to call a
function with keyword parameters, but most functions expect keyword
parameters as a dict. They are implemented with
PyArg_ParseTupleAndKeywords() which expects a dict.

--

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Uri Okrent

Uri Okrent added the comment:

I updated the patch to improve the tests and made the same change to 
xmlrpc.client.ProtocolError (which was the only other place in xmlrpc.client).  
I'll let you decide if this patch is better despite the fact that it suffers 
from the same data duplication as Fault.

If not, we can go back to just fixing Fault, or come up with a fancier solution 
entirely that doesn't duplicate data.  Though, I hesitate to start getting too 
fancy for two reasons: 1) this module is old and stable, and 2) these are 
exception objects, so while the data duplication is ugly, the instances 
themselves should be short-lived.

--
Added file: 
http://bugs.python.org/file43322/0001-xmlrpc.client-make-Errors-pickleable.patch

___
Python tracker 

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



[issue15657] Error in Python 3 docs for PyMethodDef

2016-06-09 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
nosy: +belopolsky

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

Serhiy Storchaka added the comment:

See issue27213. Maybe fast call with keyword arguments would avoid the creation 
of a dict.

--

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Uri Okrent

Uri Okrent added the comment:

My reading of the docs leads me to lean towards bug since this seems to break 
the contract of BaseException API in a standard lib module:

https://docs.python.org/3/library/exceptions.html#BaseException says 
BaseExceptions have args and with_traceback so those probably should be 
preserved in all standard lib inheritors.

This excerpt from the tutorial also seems to imply the same:
https://docs.python.org/3/tutorial/errors.html#user-defined-exceptions

"In this example, the default __init__() of Exception has been overridden. The 
new behavior simply creates the value attribute. This replaces the default 
behavior of creating the args attribute."

The tutorial goes out of its way to note that the default behavior of creating 
args has been replaced in this simple example -- i.e., one would expect args to 
be present.


As for your other comments, should I make a similar change to other inheritors 
of xmlrpc.client that inherit from xmlrpc.client.Error?  Should I instead 
completely remove Fault's constructor and just make faultCode and faultString 
properties so the attributes aren't duplicated (that seems like it may be 
dangerous)?

I will update the test for pickling with the other protocols.

--

___
Python tracker 

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



[issue27243] __aiter__ should return async iterator instead of awaitable

2016-06-09 Thread Yury Selivanov

Yury Selivanov added the comment:

Thanks a lot, Nick!  I've merged the patch.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 

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



[issue27243] __aiter__ should return async iterator instead of awaitable

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 93ad47d63b87 by Yury Selivanov in branch '3.5':
Issue #27243: Fix __aiter__ protocol
https://hg.python.org/cpython/rev/93ad47d63b87

New changeset 9ff95c30a38e by Yury Selivanov in branch 'default':
Merge 3.5 (issue #27243)
https://hg.python.org/cpython/rev/9ff95c30a38e

--
nosy: +python-dev

___
Python tracker 

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



[issue27265] Hash of different, specific Decimals created from str is the same

2016-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> resolved

___
Python tracker 

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



[issue27265] Hash of different, specific Decimals created from str is the same

2016-06-09 Thread Radosław Szalski

Radosław Szalski added the comment:

Thanks for the comments, you are both correct. I think that the issue is 
resolved now, so I'm closing this a won't 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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This looks reasonable.

But since Fault never was unpickleable, this issue is in gray zone between bug 
fixing and adding new feature. The latter can be done only in new Python 
version. I hesitate with classification of this issue.

There are a lot of other exceptions that can't be unpickled (including 
xmlrpc.client.ProtocolError). This may be a part of larger issue.

As for the patch itself, it solves the issue. But faultCode and faultString are 
saved twice (this is not a large problem for multiprocessing). Test should test 
pickling with all possible protocols (see how other pickle tests are written).

--

___
Python tracker 

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



[issue27265] Hash of different, specific Decimals created from str is the same

2016-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Note that Decimal(0.05) != Decimal('0.05').

>>> Decimal(0.05)
Decimal('0.05000277555756156289135105907917022705078125')
>>> hash(Decimal(0.05))
966367654
>>> hash(Decimal('0.05000277555756156289135105907917022705078125'))
966367654
>>> hash(0.05)
966367654

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread Tim Peters

Tim Peters added the comment:

Ah!  Yes, .getrandbits(N) outputs remain vulnerable to equation-solving in 
Python 3, for any value of N.  I haven't seen any code where that matters (may 
be "a security hole"), but would bet some _could_ be found.

There's no claim of absolute security here.  To the contrary.  What I'm opposed 
to is making _all_ naive code vulnerable to easy script-kiddie brute force 
attacks against lame seeding.

The kinds of things people _were_ jumping up & down about were the many 
instances of stuff like this on the web:

https://stackoverflow.com/questions/3854692/generate-password-in-python

Again, I'd be impressed if you could write code under Python 3 to deduce the MT 
state from any number of outputs from his naive approach in reasonable time.  
Of course he should be using urandom() instead (as an unaccepted answer urges) 
- but much code plain doesn't, and in Python 3 it's resistant to any attack the 
PHP paper exposed.

Make seeding lame again, and the easiest attacks can succeed again (the 
equation-solving stuff remains a footnote to me).

--

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Uri Okrent

Uri Okrent added the comment:

I'm not pickling/unpickling it directly, I'm using multiprocessing to handle 
queries to my server in worker processes which is using pickle to propagate 
exceptions raised in the worker to the parent.

I could instead raise a different exception and wrap it in a Fault later (which 
is what I ended up doing to avoid the issue), but it seems like a case of 
"to-may-to" vs. "to-mah-to".  Either way an Exception should be able to be 
propagated up to the parent in multiprocessing, whether it's my own or Fault.

--

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Why you need to pickle Fault?

--

___
Python tracker 

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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread Donald Stufft

Donald Stufft added the comment:

> Sorry, I don't know what "it" refers to.  Surely not to a program exposing 
> the output of .getstate()?!

random.getrandbits()

--

___
Python tracker 

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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread Tim Peters

Tim Peters added the comment:

> Searching github pulls up a number of results of people
> calling it, but I haven't looked through them to see
> how/why they're calling it.

Sorry, I don't know what "it" refers to.  Surely not to a program exposing the 
output of .getstate()?!

Regardless, there was a long discussion about the `secrets` module at the time, 
and nobody found any real code vulnerable to the approaches in the PHP paper 
under Python 3 (contrived code, certainly - that's easy).  Again, exploiting 
lame seeding alone sufficed to crack most of their examples, and Python's use 
of urandom() for seeding eliminated that approach (in Python 2 too).  

Examples potentially vulnerable to state equation-solving were "just like" what 
the PHP coders rolled by hand:  uses of things like .choice() and .randrange() 
to build "random" strings (passwords, session tokens, ...), from relatively 
small alphabets.  The smaller the alphabet, the more resistant Python 3 is to 
this approach, because the more likely ._randbelow() will invisibly skip over 
MT outputs.

For a while an incorrect claim was mistakenly accepted:  that when 
len(alphabet) was a power of 2, choice(alphabet) made an always-known number of 
MT calls.  If that were true, the equation solver could deduce the state 
quickly in such cases, which are relatively common.  But it's false - 
._randbelow() is actually _most_ likely to skip over MT outputs when it's 
making a choice from a power-of-2 number of possibilities.  That's not obvious 
from a glance at the code.

I remain -1 on making seeding "dumb" again.  But I don't care whether urandom() 
returns low-quality bytes in the boot-time edge cases people are upset about.  
They're still likely to be "better" than anything spun out of stuff like 
time.time().

--

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27265] Hash of different, specific Decimals created from str is the same

2016-06-09 Thread Mark Dickinson

Mark Dickinson added the comment:

> the behavior differs simply based on whether the Decimal was created from a 
> string vs a float

That's not quite right: a Decimal object keeps no knowledge of how it was 
created. The behaviour differs depending on whether the value of the Decimal 
happens to be exactly representable as a Python float or not. That's necessary 
to ensure the invariant `x == y` implies `hash(x) == hash(y)` continues to hold 
across types (though Python 3 has a better way of doing this).

So for example `Decimal('0.375')` was created from a string, but will hash 
equal to the exactly equal float `0.375`:

noether:float-proofs mdickinson$ python2
Python 2.7.11 (default, May  1 2016, 08:20:00) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal
>>> hash(Decimal('0.375')), hash(Decimal(0.375))
(1610579968, 1610579968)
>>> hash(0.375)
1610579968

--

___
Python tracker 

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



[issue27282] Raise BlockingIOError in os.urandom if kernel is not ready

2016-06-09 Thread Nick Coghlan

Nick Coghlan added the comment:

Quoting http://bugs.python.org/issue27266#msg268043:

The key advantage the BlockingIOError model offers is that it's trivial to 
build a blocking version as a busy loop around the non-blocking version:

def urandom_wait_for_entropy(num_bytes):
while True:
try:
return os.urandom(num_bytes)
except BlockingIOError:
pass

And if you ignore the problem and just call os.urandom(), you'll almost 
certainly be fine unless you're working with Linux boot scripts or embedded ARM 
devices (in which case, this point will be minor compared to the other arcana 
you're dealing with).

--

___
Python tracker 

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



[issue27266] Always use getrandom() in os.random() on Linux and add block=False parameter to os.urandom()

2016-06-09 Thread Nick Coghlan

Nick Coghlan added the comment:

Since Victor requested it, I filed #27282 to track the "raise BlockingIOError 
if the kernel would block" design option.

The key advantage that particular model offers is that it's trivial to build a 
blocking version as a busy loop around the non-blocking version:

def urandom_wait_for_entropy(num_bytes):
while True:
try:
return os.urandom(num_bytes)
except BlockingIOError:
pass

And if you ignore the problem and just call os.urandom(), you'll almost 
certainly be fine unless you're working with Linux boot scripts or embedded ARM 
devices (in which case, this point will be minor compared to the other arcana 
you're dealing with).

--

___
Python tracker 

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



[issue27282] Raise BlockingIOError in os.urandom if kernel is not ready

2016-06-09 Thread Donald Stufft

Donald Stufft added the comment:

This proposal is reasonable to me and solves any problems I have with the 
default behavior of os.urandom.

--
nosy: +dstufft

___
Python tracker 

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



[issue27282] Raise BlockingIOError in os.urandom if kernel is not ready

2016-06-09 Thread Nick Coghlan

New submission from Nick Coghlan:

This proposal competes directly with #27250, #27266, and #27279 as possible 
long term solutions to the Linux/systemd os.urandom deadlock bug described in 
#26839

Rather than adding new APIs, or making os.urandom potentially blocking on Linux 
(as it was in 3.5.0 and 3.5.1), it instead proposes that os.urandom immediately 
raise BlockingIOError if the kernel entropy pool has not yet been initialised.

This behaviour will mean that users attempting to gather strong entropy too 
early in the Linux boot process will fail rather than block, so affected 
scripts and programs can readily fall back to reading from /dev/urandom or 
using the random module APIs if they don't need cryptographically strong random 
data. Scripts that do need cryptographically strong random data can either poll 
os.urandom until it succeeds, or else fail explicitly and let their caller 
resolve the problem.

--
messages: 268041
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Raise BlockingIOError in os.urandom if kernel is not ready
type: enhancement
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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread Donald Stufft

Donald Stufft added the comment:

> But that's not what real-life programs expose.

Are you sure? Searching github pulls up a number of results of people calling 
it, but I haven't looked through them to see how/why they're calling it.

> What do you believe?  For example, do you believe it would remain a disaster 
> if MT initialization wanted only 1 byte from urandom()?  Or is 0 the only 
> value you can live with?

I don't really care that much what random.Random initialized with except as it 
related to what os.urandom does by default. Here's a copy/paste from my email 
to python-dev about it:

* Use getrandom(GRND_NONBLOCK) for random.Random since it doesn't matter if we
  get cryptographically secure random numbers or not.
* Switch it to use something other than a CSPRNG by default since it doesn't
  need that.
* Instead of seeding itself from os.urandom on import, have it lazily do that
  the first time one of the random.rand* functions are called.
* Do nothing, and say that ``import random`` relies on having the kernel's
  urandom pool initialized.

Between these options, I have a slight preference for switching it to use a non 
CSPRNG, but I really don't care that much which of these options we pick. Using 
random.Random is not secure and none of the above options meaningfully change 
the security posture of something that accidently uses it.

--

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Berker Peksag

Berker Peksag added the comment:

Looks good to me, thanks.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue27279] Add random.cryptorandom() and random.pseudorandom, deprecate os.urandom()

2016-06-09 Thread Nick Coghlan

Nick Coghlan added the comment:

As with other proposals to add new APIs, I think this is an overreaction to a 
Linux specific problem. Linux system boot could deadlock with 3.5.0 and 3.5.1 
due to:

- CPython startup using os.urandom() when it wasn't necessary
- systemd invoking a Python script before the OS entropy pool had been 
initialised (which then deadlocked until the Python invocation timed out)

As long as we switch the internal hash algorithm to seeding from a non-blocking 
random source, and also ensure that importing the random module doesn't 
implicitly call os.urandom, then any other software that only needs 
pseudorandom data can just use the random module APIs.

--
nosy: +ncoghlan

___
Python tracker 

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



[issue27271] asyncio lost udp packets

2016-06-09 Thread Guido van Rossum

Guido van Rossum added the comment:

You're welcome Valdemar. It's a wonderful world, there's so much to learn!
Sounds like you're on the right path. Good luck!

--

___
Python tracker 

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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread Tim Peters

Tim Peters added the comment:

Donald, your script appears to recreate the state from some hundreds of 
consecutive outputs of getrandbits(64).  Well, sure - but what of it?  That 
just requires inverting the MT's tempering permutation.  You may as well note 
that the state can be recreated from the output of random.getstate() - in which 
case, your script could be a lot shorter too ;-)

But that's not what real-life programs expose.  All the flaws in the PHP paper 
related to deducing PRNG state were found in real-life code using idiomatic PHP 
ways of spelling choice() or randrange(), with relatively few possible outputs.

Produce a program that can deduce the state, in Python 3, from - say - a 
million consecutive outputs of randrange(256), and _that_ would be interesting, 
because that would be relevant.  It's easy in Python 2.  But in Python 3, you 
can't tell from the outputs how many times MT was invoked under the covers 
(but, of course, you can from your contrived getrandbits(64) outputs - the 
C-level MT is called exactly twice for each of those outputs).

In any case, the vast bulk of the PHP flaws were found by out-brute-forcing 
dumb PRNG initialization, which requires nothing in the way of reproducing 
state via reverse-engineering outputs (see Figure 13).  Noting that idiomatic 
use of Python 3's choice() (etc) is resistant to the paper's equation-solving 
state-deducing approach is really just a footnote - the _point_ is that lame 
seeding is, all by itself, a Bad Idea.  That alone was enough to crack most of 
the PHP programs the paper covered.

As to the rest, there are already too many massive bug reports arguing about 
urandom()-in-general.  The title of _this_ bug report suggested it may be good 
enough to reduce the _number_ of urandom() bytes MT initialization uses.  But, 
so far, Victor & I appear to be the only ones who made an on-topic comment 
about that ;-)

What do you believe?  For example, do you believe it would remain a disaster if 
MT initialization wanted only 1 byte from urandom()?  Or is 0 the only value 
you can live with?

--

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +loewis
stage:  -> patch review
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



[issue27243] __aiter__ should return async iterator instead of awaitable

2016-06-09 Thread Nick Coghlan

Nick Coghlan added the comment:

+1 from me - my only comments were on the docs updates and one of the 
explanatory comments in the code.

--

___
Python tracker 

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



[issue27274] [ctypes] Allow from_pointer creation

2016-06-09 Thread Memeplex

Memeplex added the comment:

> The first argument can be any type accepted by c_void_p.from_param, such as a 
> ctypes pointer/array, str, bytes, or an integer address.

Now I see why you suggested ptr.as_void in 26565. Both issues are very related. 
Some functions are overloaded in the sense they automatically call 
c_void_p.from_param on their arguments; other functions aren't. Uniformity 
would dictate to treat all functions expecting an address the same way. Anyway 
this would not cover all use cases for ptr.toaddress or ptr.as_void or whatever 
it gets called.

--

___
Python tracker 

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



[issue26985] Information about CodeType in inspect documentation is outdated

2016-06-09 Thread Berker Peksag

Berker Peksag added the comment:

"Return true if the object is a code object." should stay. We can add a short 
sentence to refer people to the inspect documentation for the list of co_* 
attributes.

--

___
Python tracker 

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



[issue27274] [ctypes] Allow from_pointer creation

2016-06-09 Thread Memeplex

Memeplex added the comment:

Thank you for the great tips, Eryk, somehow I overlooked string_at while 
reading the docs.

Now, given that the address parameter of string_at is pretty overloaded, 
wouldn't it be reasonable to overload from_address the same instead of 
introducing from_pointer? That is, everywhere an address is expected, an 
address-like ctypes object would be ok.

--

___
Python tracker 

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



[issue27271] asyncio lost udp packets

2016-06-09 Thread valdemar pavesi

valdemar pavesi added the comment:

thanks Guido and Yury

I am new on python world. I was working with automation tests, sw implemented 
in Delphi in 199x.

this year I got a python certification from University Texas Arlington 
University by EDX.

and I already wrote 4 projects in python3 ,handling heavy traffic , one related 
to voice over lte simulation.

thanks for all your contribution to the world without asking nothing back.


regards!
valdemar

--

___
Python tracker 

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



[issue26985] Information about CodeType in inspect documentation is outdated

2016-06-09 Thread Xiang Zhang

Xiang Zhang added the comment:

So maybe remove the docstring entirely?

--

___
Python tracker 

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



[issue27265] Hash of different, specific Decimals created from str is the same

2016-06-09 Thread Radosław Szalski

Radosław Szalski added the comment:

Thanks for the reply and analysis, Mark.

My motivation was that as a "clueless user", I shouldn't worry about how 
Decimals are created. Given two equal numbers, I would expect their behavior 
(e.g., result of a hash) to be the same as well. In this example, the behavior 
differs simply based on whether the Decimal was created from a string vs a 
float.

However, since there are bound to be collisions, and the performance overhead 
is negligible (in case of a collision), and Python 3 solves this problem I 
agree this can be closed as "won't-fix".

--
status: pending -> open

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Uri Okrent

New submission from Uri Okrent:

Attempting to unpickle an xmlrpc.client.Fault will raise a TypeError:

>>> import xmlrpc.client as xmlrpclib
>>> f = xmlrpclib.Fault(42, 'Test Fault')
>>> import pickle
>>> s = pickle.dumps(f)
>>> pickle.loads(s)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: __init__() missing 2 required positional arguments: 'faultCode' and 
'faultString'

Apparently unpickle relies on BaseException's args attribute when 
reconstructing an Exception class that inherits from BaseException (Fault 
inherits from Exception).  Unfortunately, Fault implements __init__() and does 
call the base class constructor, but does not pass its arguments, so Fault.args 
is always an empty tuple.

Simply passing Fault's arguments to the base class constructor allows it to be 
unpickled.

I've included a patch for 3.x but the issue is present in 2.x as well (the code 
and fix are exactly the same except in xmlrpclib.py).

--
components: Library (Lib)
files: 0001-xmlrpc.client-make-Fault-pickleable.patch
keywords: patch
messages: 268028
nosy: Uri Okrent
priority: normal
severity: normal
status: open
title: unpickling an xmlrpc.client.Fault raises TypeError
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: 
http://bugs.python.org/file43321/0001-xmlrpc.client-make-Fault-pickleable.patch

___
Python tracker 

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



[issue27270] 'parentheses-equality' warnings when building with clang and ccache

2016-06-09 Thread STINNER Victor

STINNER Victor added the comment:

clang_ccache.patch LGTM.

--
nosy: +haypo

___
Python tracker 

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



[issue13420] newer() function in dep_util.py discard changes in the same second

2016-06-09 Thread Jakub Wilk

Changes by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

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



[issue18027] distutils should access stat_result timestamps via .st_*time attributes

2016-06-09 Thread Berker Peksag

Berker Peksag added the comment:

This is a duplicate of issue 13420.

--
nosy: +berker.peksag
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> newer() function in dep_util.py discard changes in the same 
second

___
Python tracker 

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



[issue27264] python 3.4 vs. 3.5 strftime same locale different output on Windows

2016-06-09 Thread Eryk Sun

Changes by Eryk Sun :


--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue26243] zlib.compress level as keyword argument

2016-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The original request was for supporting level as keyword argument. Making the 
first argument a keyword argument was unintentional side effect (due a to the 
limitation of argument parsing functions). Now it is possible to support 
positional-only and keyword arguments in one function (see issue26282). 
Proposed patch makes the first argument positional-only again.

--
nosy: +serhiy.storchaka
resolution: fixed -> 
stage: resolved -> patch review
status: closed -> open
Added file: 
http://bugs.python.org/file43320/zlib_compress_positional_only_data.patch

___
Python tracker 

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



[issue23026] Winreg module doesn't support REG_QWORD, small DWORD doc update

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5306f27c53aa by Serhiy Storchaka in branch 'default':
Regenerate Argument Clinic code for issue #23026.
https://hg.python.org/cpython/rev/5306f27c53aa

--

___
Python tracker 

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



[issue26305] Make Argument Clinic to generate PEP 7 conforming code

2016-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue26305] Make Argument Clinic to generate PEP 7 conforming code

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset eeb742d8bf9c by Serhiy Storchaka in branch '3.5':
Issue #26305: Argument Clinic now escapes braces. No need to double them.
https://hg.python.org/cpython/rev/eeb742d8bf9c

New changeset d983c313b8f1 by Serhiy Storchaka in branch 'default':
Issue #26305: Argument Clinic now escapes braces. No need to double them.
https://hg.python.org/cpython/rev/d983c313b8f1

New changeset 2d7dcd8cf928 by Serhiy Storchaka in branch 'default':
Issue #26305: Argument Clinic now uses braces in C code as required by PEP 7.
https://hg.python.org/cpython/rev/2d7dcd8cf928

--
nosy: +python-dev

___
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-06-09 Thread Mark Dickinson

Mark Dickinson added the comment:

> Hmm, well, I don't have SciPy installed, but I've found that despite 
> their (well-deserved) reputation, numpy (and presumably scipy) often 
> have rather naive algorithms that can lose accuracy rather 
> spectacularly.

Agreed. And as Ram Rachum hinted, there seems little point aiming to duplicate 
things that already exist in the de facto standard scientific libraries. So I 
think there's a place for a non-naive carefully computed geometric mean in the 
std. lib. statistics module, but I wouldn't see the point of simply adding an 
exp-mean-log implementation (not that anyone is advocating that).

--

___
Python tracker 

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



[issue26305] Make Argument Clinic to generate PEP 7 conforming code

2016-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue23867] Argument Clinic: inline parsing code for 1-argument functions

2016-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage: patch review -> needs patch

___
Python tracker 

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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2016-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage: patch review -> needs patch

___
Python tracker 

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



[issue27140] Opcode for creating dict with constant keys

2016-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could anyone please make a review?

--
keywords: +needs review

___
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-06-09 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On Thu, Jun 09, 2016 at 09:24:04AM +, Mark Dickinson wrote:

> On the other hand, apparently `exp(mean(log(...)))` is good enough for SciPy:

Hmm, well, I don't have SciPy installed, but I've found that despite 
their (well-deserved) reputation, numpy (and presumably scipy) often 
have rather naive algorithms that can lose accuracy rather 
spectacularly.

py> statistics.mean([1e50, 2e-50, -1e50, 2e-50])
1e-50
py> np.mean(np.array([1e50, 2e-50, -1e50, 2e-50]))
5e-51

py> statistics.mean([1e50, 2e-50, -1e50, 2e-50]*1000)
1e-50
py> np.mean(np.array([1e50, 2e-50, -1e50, 2e-50]*1000))
5.0002e-54

On the other hand, np is probably a hundred times (or more) faster, so I 
suppose accuracy/speed makes a good trade off.

--

___
Python tracker 

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



[issue26826] Expose new copy_file_range() syscall in os module.

2016-06-09 Thread Marcos Dione

Marcos Dione added the comment:

ENOSYS catching fixed.

--
Added file: http://bugs.python.org/file43319/copy_file_range.diff

___
Python tracker 

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



[issue26839] Python 3.5 running on Linux kernel 3.17+ can block at startup or on importing the random module on getrandom()

2016-06-09 Thread Larry Hastings

Larry Hastings added the comment:

I just posted to python-dev and asked Guido to make a BDFL ruling.  I only 
represented my side, both because I worried I'd do a bad job of representing 
*cough* literally everybody else *cough*, and because it already took me so 
long to write the email.  All of you who disagree with me, I'd appreciate it if 
you'd reply to my python-dev posting and state your point of view.

--

___
Python tracker 

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



[issue27266] Always use getrandom() in os.random() on Linux and add block=False parameter to os.urandom()

2016-06-09 Thread Donald Stufft

Donald Stufft added the comment:

Having os.urandom raise an error instead of blocking is OK with me. It turns an 
implicit error into an explicit one. However, I prefer to have it block until 
it has initialized it's entropy pool because that makes Linux behave similarly 
to all of the other major, modern OSs instead of making Linux continue to be a 
weird edge case.

--

___
Python tracker 

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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread Donald Stufft

Donald Stufft added the comment:

If seeding from urandom was causing no problems, then I would not care if 
random.Random() wanted to seed from urandom, even though it doesn't need to. 
However it is causing problems, and thus it shouldn't.

Here's another script, this one runs on Python 3.5.1 that can clone MT using 
nothing but it's output: 
https://gist.github.com/dstufft/394ea7dd8f64159df10e25a75865c03c.

--

___
Python tracker 

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



[issue26826] Expose new copy_file_range() syscall in os module.

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

It’s a bit ugly, but I would write the test so that it is recorded as skipped:

try:
os.copy_file_range(...)
except OSError as err:
if err.errno != ENOSYS:
raise  # We get to see the full exception details
self.skipTest(err)  # Test is recorded as skipped, not passed

--

___
Python tracker 

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



[issue27279] Add random.cryptorandom() and random.pseudorandom, deprecate os.urandom()

2016-06-09 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Resources for entropy gathering sources:

 * Kernel based devices such as /dev/random:
   https://en.wikipedia.org/wiki//dev/random

 * EGD - old entropy gathering daemon; blocks when out of
   entropy
   http://egd.sourceforge.net/
   (not maintained anymore)

   Important here is not the original implementation, but
   the Unix domain socket interface, which many applications
   support.

 * PRNG - provides the EGD interface, but feeds entropy into
   the OpenSSL pool; essentially a CPRNG with EGD interface.
   http://prngd.sourceforge.net/
   
 * Virtio RNG - paravirtualized device for passing host RNG
   to guest VMs (running under KVM)
   https://fedoraproject.org/wiki/Features/Virtio_RNG
   
 * haveged - entropy daemon which feeds entropy into the
   Linux /dev/random pool
   http://www.issihosts.com/haveged/
   https://wiki.archlinux.org/index.php/Haveged
   
   Whether this is useful on VMs, is contested, due to the way
   haveged works (reliance on rdtsc instructions which don't work
   well in VMs)
   
http://security.stackexchange.com/questions/34523/is-it-appropriate-to-use-haveged-as-a-source-of-entropy-on-virtual-machines
   
 * Hardware RNG in Raspberry Pi:
   
https://sites.google.com/site/astudyofentropy/project-definition/raspberry-pi-internal-hardware-random-number-generator
   
 * rng-tools - provides the rngd daemon to feed entropy from
   hardware RNGs into the Linux /dev/random pool
   https://wiki.archlinux.org/index.php/Rng-tools
   http://linux.die.net/man/8/rngd

--

___
Python tracker 

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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread STINNER Victor

STINNER Victor added the comment:

> On 'import random' seed random.Random() from _Py_HashSecret.random_seed + 
> gettimeofday().tv_sec + gettimeofday().tv_usec + id(self). That way 
> subinterpreters get a different init state.

Can we use os.urandom() was random.Random is instanciated manually,
but use the "secret random seed" when the random module is imported?

You can easily restrict the feature to workaround blocking "import
random" on VM: consume the secret in the C code, and ensure that it's
only used once.

For example, reimplement random.Random.seed() in C (remove the Python
implementation) and use the secret in C, but only the first user of
seed(None) will get it. WDYT?

--

___
Python tracker 

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



[issue27277] Fatal Python error: Segmentation fault in test_exceptions

2016-06-09 Thread SilentGhost

Changes by SilentGhost :


--
components: +Tests

___
Python tracker 

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



[issue27280] Paste fail in ipaddress documentation

2016-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +pmoody

___
Python tracker 

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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread Christian Heimes

Christian Heimes added the comment:

New plan:

* Add a new uint64 _Py_HashSecret.random_seed
* On 'import random' seed random.Random() from _Py_HashSecret.random_seed + 
gettimeofday().tv_sec + gettimeofday().tv_usec + id(self). That way 
subinterpreters get a different init state.

On systems with a good entropy source, _Py_HashSecret will be filled with 
cryptographically strong material. On early boot / VM scenarios the situation 
is a bit degraded but still properly good enough. It's better than to seed from 
a bad RNG or just from time.time().

--

___
Python tracker 

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



[issue26826] Expose new copy_file_range() syscall in os module.

2016-06-09 Thread Marcos Dione

Marcos Dione added the comment:

Fixed the last comments, including comparing what was written to the original 
data, but only to the length of what was actually written. I'm just not sure if 
the way to handle the syscall not existing is ok.

--
Added file: http://bugs.python.org/file43318/copy_file_range.diff

___
Python tracker 

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



  1   2   >