[issue26870] Unexpected call to readline's add_history in call_readline

2016-05-08 Thread Martin Panter

Martin Panter added the comment:

Here is a patch including a unit test. I have only tested it on Linux. It would 
be awesome of other people could test it on other Unix platforms, in case the 
pseudoterminal stuff needs fixing.

--
Added file: http://bugs.python.org/file42788/set_auto_history.v2.patch

___
Python tracker 

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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-05-08 Thread James Tatum

James Tatum added the comment:

FYI, NamedTemporaryFile doesn't work well with Windows. There are a handful of 
issues about it.

--
nosy: +James.Tatum

___
Python tracker 

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



[issue26982] Clarify forward annotations in PEP 484

2016-05-08 Thread Guido van Rossum

Changes by Guido van Rossum :


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

___
Python tracker 

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



[issue18531] Undocumented different between METH_KEYWORDS and **kws

2016-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Now this is just the documentation issue. I think the change of the behavior in 
3.6 should be documented too, but I even don't know where.

--

___
Python tracker 

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



[issue23213] subprocess communicate() hangs when stderr isn't closed

2016-05-08 Thread Martin Panter

Martin Panter added the comment:

I suggest closing this. Depending on what the daemons are supposed to do, I 
think this is either a bug with “systemd” and PHP holding onto stderr when they 
become daemons, or a bug/misunderstanding with how Thomas was using the 
subprocess module and communicate().

--
resolution:  -> third party
status: open -> pending

___
Python tracker 

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



[issue18531] Undocumented different between METH_KEYWORDS and **kws

2016-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I'm not sure PyObject_GetItem instead of PyDict_GetItem in 3.x completely
> explains things, because the code in issue 6081 also works in 2.7.

It doesn't work to me in current develop 2.7.11+. What version did you test?

--

___
Python tracker 

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



[issue6445] Add check parameter to subprocess.Popen.communicate

2016-05-08 Thread Martin Panter

Martin Panter added the comment:

According to PEP 375, 3.1 was out on 27 June 2009, just before this report was 
opened (9 July). So perhaps OG7 wasn’t aware of check_output() at the time. But 
it sounds like they did want CalledProcessError to be raised.

I suggest to close this, unless there is demand for some new feature.

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

___
Python tracker 

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



[issue26982] Clarify forward annotations in PEP 484

2016-05-08 Thread James Tatum

Changes by James Tatum :


Removed file: http://bugs.python.org/file42786/forward_references.patch

___
Python tracker 

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



[issue26982] Clarify forward annotations in PEP 484

2016-05-08 Thread James Tatum

Changes by James Tatum :


Added file: http://bugs.python.org/file42787/forward_references.patch

___
Python tracker 

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



[issue25901] `make test` crashes in test_httpservers

2016-05-08 Thread Martin Panter

Martin Panter added the comment:

It is not clear what compiler options you changed (you just gave the entire 
link command lines).

Does the crash occur every time, or only once? Does it occur if you run 
test_httpservers alone, without the other tests:

./python Tools/scripts/run_tests.py test_httpservers

It seems the crash happened inside a socket.bind() call. Ideally, it would be 
nice to investigate with GDB exactly where it crashes.

--
nosy: +martin.panter

___
Python tracker 

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



[issue26982] Clarify forward annotations in PEP 484

2016-05-08 Thread James Tatum

Changes by James Tatum :


Added file: http://bugs.python.org/file42786/forward_references.patch

___
Python tracker 

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



[issue26982] Clarify forward annotations in PEP 484

2016-05-08 Thread James Tatum

Changes by James Tatum :


Removed file: http://bugs.python.org/file42785/forward_references.patch

___
Python tracker 

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



[issue26982] Clarify forward annotations in PEP 484

2016-05-08 Thread James Tatum

New submission from James Tatum:

In https://github.com/python/typeshed/issues/180, we discussed a slight 
ambiguity with PEP 484's mention of forward references. It wasn't entirely 
clear that they don't apply unless using function annotations. This patch 
attempts to clear up the ambiguity.

--
assignee: docs@python
components: Documentation
files: forward_references.patch
keywords: patch
messages: 265177
nosy: James.Tatum, docs@python
priority: normal
severity: normal
status: open
title: Clarify forward annotations in PEP 484
Added file: http://bugs.python.org/file42785/forward_references.patch

___
Python tracker 

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



[issue25901] `make test` crashes in test_httpservers

2016-05-08 Thread ppperry

Changes by ppperry :


--
title: make test crash in test_httpservers -> `make test` crashes in 
test_httpservers

___
Python tracker 

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



[issue26981] add compatibility shim for enum34 backport

2016-05-08 Thread Ethan Furman

Ethan Furman added the comment:

It would, but that's not what we did.

Currently we have _name_ and _value_; the backport uses __order__ because I 
didn't want the stdlib version having a hairball when someone tried to use a 
2.7 Enum in 3.4 and it didn't occur to me at the time to just add and ignore 
_order_.

--

___
Python tracker 

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



[issue26981] add compatibility shim for enum34 backport

2016-05-08 Thread Eric V. Smith

Eric V. Smith added the comment:

Doesn't namedtuple use _fields (as opposed to _fields_) for a similar purpose? 
Would Enum using _order be more consistent with that?

--
nosy: +eric.smith

___
Python tracker 

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



[issue26981] add compatibility shim for enum34 backport

2016-05-08 Thread Ethan Furman

New submission from Ethan Furman:

_sunder_ methods are reserved for internal Enum use, and if the user tries to 
use any an exception is raised.

Consequently, the enum34 backport uses __order__ instead of _order_ to specify 
a definition order for its members.

I would like to do two things:

1) add _order_ to the stdlib version

2) ensure the actual definition order is the same as what is specified
   in _order_

--
assignee: ethan.furman
messages: 265174
nosy: barry, eli.bendersky, ethan.furman
priority: normal
severity: normal
stage: needs patch
status: open
title: add compatibility shim for enum34 backport
type: behavior
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



[issue26969] ascynio should provide a policy to address pass-loop-everywhere problem

2016-05-08 Thread Guido van Rossum

Guido van Rossum added the comment:

No, that specifically sounds like asking for trouble to me. You don't know
what else that coroutine is waiting for, and it may be waiting for some I/O
whose socket is registered with the other event loop. Since the other event
loop won't make progress, you'd be deadlocked.

--

___
Python tracker 

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



[issue26969] ascynio should provide a policy to address pass-loop-everywhere problem

2016-05-08 Thread Guido van Rossum

Guido van Rossum added the comment:

PS. If you have something you sometimes want to run synchronously and
sometimes as a coroutine, you probably need to refactor it somehow.

--

___
Python tracker 

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



[issue18531] Undocumented different between METH_KEYWORDS and **kws

2016-05-08 Thread Eric V. Smith

Eric V. Smith added the comment:

I'm not sure PyObject_GetItem instead of PyDict_GetItem in 3.x completely 
explains things, because the code in issue 6081 also works in 2.7.

But I don't think it's terribly important in any event, as long as we 
understand the 3.x difference. Thanks for researching!

--

___
Python tracker 

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



[issue26512] Vocabulary: Using "integral" in library/stdtypes.html

2016-05-08 Thread Martin Panter

Changes by Martin Panter :


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



[issue26980] The path argument of asyncio.BaseEventLoop.create_unix_connection is not documented

2016-05-08 Thread texttheater

New submission from texttheater:

The documentation does not say what this argument is for.

It says "See the BaseEventLoop.create_connection() method for parameters", but 
that method does not have a path argument.

The argument seems to be required unless the keyword argument sock is given.

--
assignee: docs@python
components: Documentation
messages: 265170
nosy: docs@python, texttheater
priority: normal
severity: normal
status: open
title: The path argument of asyncio.BaseEventLoop.create_unix_connection is not 
documented
versions: Python 3.4, 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



[issue25745] Reference leaks in test_curses

2016-05-08 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



[issue25745] Reference leaks in test_curses

2016-05-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset afed12943ddd by Serhiy Storchaka in branch '3.5':
Issue #25745: Fixed leaking a userptr in curses panel destructor.
https://hg.python.org/cpython/rev/afed12943ddd

New changeset 1662b41e1663 by Serhiy Storchaka in branch '2.7':
Issue #25745: Fixed leaking a userptr in curses panel destructor.
https://hg.python.org/cpython/rev/1662b41e1663

New changeset 50a94e1cabe0 by Serhiy Storchaka in branch 'default':
Issue #25745: Fixed leaking a userptr in curses panel destructor.
https://hg.python.org/cpython/rev/50a94e1cabe0

--
nosy: +python-dev

___
Python tracker 

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



[issue26736] Use HTTPS protocol in links

2016-05-08 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



[issue26881] modulefinder should reuse the dis module

2016-05-08 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



[issue26881] modulefinder should reuse the dis module

2016-05-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3579cdaf56d9 by Serhiy Storchaka in branch '3.5':
Issue #26881: The modulefinder module now supports extended opcode arguments.
https://hg.python.org/cpython/rev/3579cdaf56d9

New changeset c27e3773d0f9 by Serhiy Storchaka in branch 'default':
Issue #26881: The modulefinder module now supports extended opcode arguments.
https://hg.python.org/cpython/rev/c27e3773d0f9

New changeset f06baed1bb0c by Serhiy Storchaka in branch '2.7':
Issue #26881: modulefinder now works with bytecode with extended args.
https://hg.python.org/cpython/rev/f06baed1bb0c

--
nosy: +python-dev

___
Python tracker 

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



[issue26967] argparse: allow_abbrev=False stops -vv from working

2016-05-08 Thread paul j3

paul j3 added the comment:

Someone needs to take the current argparse.py, set the default value of this 
parameter to False, and run the unittest file.  This should turn up this case, 
and possibly others that fail when abbreviations are turned off.  Then we have 
to debate whether such failures are acceptable or not.

When we say 'disable abbreviations' do we mean, all abbreviations, or just a 
subset?

--

___
Python tracker 

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



[issue18531] Undocumented different between METH_KEYWORDS and **kws

2016-05-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e4835b1ed7b1 by Serhiy Storchaka in branch 'default':
Issue #18531: Single var-keyword argument of dict subtype was passed
https://hg.python.org/cpython/rev/e4835b1ed7b1

--
nosy: +python-dev

___
Python tracker 

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



[issue26632] __all__ decorator

2016-05-08 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

One more diff.  As I was working on tests, I realized that the decorator 
version wasn't returning the thing it was decorating.  Changing this also 
allowed me to simplify the exit path.

I should be putting up a PyPI package soon which implements this for earlier 
Pythons (Python 3 only for now though).

--
Added file: http://bugs.python.org/file42784/26632-in-c-4.diff

___
Python tracker 

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



[issue26952] argparse help formatter crashes

2016-05-08 Thread paul j3

paul j3 added the comment:

Argument Groups are not designed for nesting, and despite their names and 
subclassing, Mutually exclusive groups and Argument Groups are not meant to be 
used together (with one exception).

I agree that the error is obscure, but it occurs in a particularly fragile 
function in the formatter, '_format_actions_usage'.  That function needs a 
major rewrite (that's in another bug/issue).

Argument Groups serve only as a way of grouping help lines.  Mutually exclusive 
groups test arguments during parsing, and add some markings to the usage line.  
So they have very different purposes.

I have seen questions on Stackoverflow where people try to use Argument Groups 
as a way of adding some sort of subgroup to the Mutually Exclusive one, one for 
example that implements a 'allow any of this group' logic.  There is a 
bug/issue asking for 'inclusive' nesting groups, but production patch of that 
sort is long ways off.  http://bugs.python.org/issue11588

This usage line

(--url URL --project Prj [--dump]) | (--mergeInput input.txt 
[--removeDisabled])

suggests that this what you are trying do - allow any of -u,-p,-d, but disallow 
one of these with -m or -r.  That logic is beyond the current group testing 
mechanism, and beyond the usage formatting code.  You'll have to do your own 
tests, and write a custom usage line.

Mutually exclusive groups can be nested in other mutual groups, but the effect 
isn't what you might hope.  It just forms a larger mutually exclusive group; 
there's no subgrouping.

It is possible to nest a mutually exclusive group in an Argument group; the 
effect is to give the mutually exclusive group a title.

--
nosy: +paul.j3

___
Python tracker 

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



[issue21012] Figure out how to best leverage pip in devinabox

2016-05-08 Thread Brett Cannon

Brett Cannon added the comment:

Devinabox has moved to its own project at 
https://github.com/python/devinabox/issues/3

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

___
Python tracker 

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



[issue23721] Set up a daily test coverage run

2016-05-08 Thread Brett Cannon

Brett Cannon added the comment:

Devinabox now lives at https://github.com/python/devinabox

--

___
Python tracker 

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



[issue26967] argparse: allow_abbrev=False stops -vv from working

2016-05-08 Thread paul j3

Changes by paul j3 :


--
priority: normal -> high

___
Python tracker 

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



[issue26967] argparse: allow_abbrev=False stops -vv from working

2016-05-08 Thread paul j3

paul j3 added the comment:

It's been 2 years since I worked on this patch.  In the issue discussion 
http://bugs.python.org/issue14910 there was no mention of short v long options. 
 The unit tests only look at longs.

The result is that with the abbrev off, it disables all use of combined shorts, 
not just the count.  Not only if '-vv' disabled, so is '-vz', '-vz1', '-v -z1'.

We should have discussed that issue.

I can imagine modifying the 

if self.allow_abbrev:

to something like

if self.allow_abbrev or :


But even if we don't go that far, we should add a documentation note.

--
nosy: +paul.j3

___
Python tracker 

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



[issue18531] Undocumented different between METH_KEYWORDS and **kws

2016-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

str.format() uses PyDict_GetItem() in 2.7, but PyObject_GetItem() in 3.x. A 
comment before:

/* Use PyObject_GetItem instead of PyDict_GetItem because this
   code is no longer just used with kwargs. It might be passed
   a non-dict when called through format_map. */

Thus the behavior of str.format() was changed by accident.

--

___
Python tracker 

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



[issue26973] Dict View binops permit non-set types

2016-05-08 Thread R. David Murray

R. David Murray added the comment:

In any case I think the backward compatibility argument torpedoes making the 
views more restrictive.

Since you agree there's no real consensus on python-ideas, I'm going to close 
this.  If there is some other consistency change that seems to make sense and 
gains consensus on python-ideas, you can open another issue.

--
nosy: +r.david.murray
resolution:  -> rejected
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



[issue26798] add BLAKE2 to hashlib

2016-05-08 Thread Dmitry Chestnykh

Dmitry Chestnykh added the comment:

> I have replaced verify() with compare_digest().

+>>> compare_digesty(cookie, '0102030405060708090a0b0c0d0e0f00')

Typo here. Also, this doesn't look like it compares the digest. Maybe you can 
keep the verify() function, but make it use compare_digest() -- this looks more 
clear to me:

>>> def verify(cookie, sig):
... good_sig = sign(cookie)
... return compare_digest(goodsig, sig)


> Python requires a C89 compatible compiler and 32bit architecture. C89 doesn't 
> mandate 64bit integers. As far as I remember there is (or was) one buildbot 
> with a compiler, that doesn't have 64 ints on an old SPARC system. All major 
> platforms have 64bit ints. I might modify the implementation when the patch 
> has landed.

Oh, I see. Thanks!

--

___
Python tracker 

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



[issue26156] Bad name into power operator syntax

2016-05-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue26156] Bad name into power operator syntax

2016-05-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e876ff4e9e95 by Serhiy Storchaka in branch '3.5':
Issue #26156: Make expressions grammar description more semantically correct.
https://hg.python.org/cpython/rev/e876ff4e9e95

New changeset 61e3160310ae by Serhiy Storchaka in branch 'default':
Issue #26156: Make expressions grammar description more semantically correct.
https://hg.python.org/cpython/rev/61e3160310ae

--
nosy: +python-dev

___
Python tracker 

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



[issue26732] multiprocessing sentinel resource leak

2016-05-08 Thread Camilla Montonen

Changes by Camilla Montonen :


--
nosy: +Winterflower

___
Python tracker 

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



[issue26156] Bad name into power operator syntax

2016-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think "await_expr" is good. It is not new that the keyword is a part of the 
grammar symbol name (yield_expression, comp_for, and_expr, or_test, 
lambda_expr).

--
assignee: docs@python -> serhiy.storchaka

___
Python tracker 

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



[issue14936] PEP 3121, 384 refactoring applied to curses_panel module

2016-05-08 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



[issue14936] PEP 3121, 384 refactoring applied to curses_panel module

2016-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This patch made the "_curses_panel.curses panel" type callable. Created objects 
were in inconsistent state and using them caused a crash.

This bug is fixed in issue23815. Opened issue26979 for documenting the catch.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue15721] PEP 3121, 384 Refactoring applied to tkinter module

2016-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Fixed in issue23815. Opened issue26979 for documenting the catch.

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



[issue23815] Segmentation fault when create _tkinter objects

2016-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

After looking closer I found that making PyType_FromSpec() not inheriting 
tp_new for static types whose base class is 'object' is not an option, because 
this breaks examples in the documentation, and likely break some third-party 
code. Opened new issue26979 for documenting the catch.

Thank you for your review Terry.

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



[issue26979] The danger of PyType_FromSpec()

2016-05-08 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

There is a catch when convert static types to dynamic types using 
PyType_FromSpec(). tp_new is not inherited for static types whose base class is 
'object' (see a comment in inherit_special() in Objects/typeobject.c:4569 for 
explanation). Such types left not callable and not pickleable unless tp_new is 
explicitly specified. But since PyType_FromSpec() creates heap types, tp_new is 
inherited from the base 'object' class. Converted types unexpectedly becomes 
callable and pickleable. Since object.__new__ wouldn't insure the invariants 
that the extension type's own factory function ensures, instantiated object can 
be in inconsistent state. Using it can lead to a crash. We already fallen two 
time in this catch with _tkinter (issue15721) and curses.panel (issue14936) 
modules (fixed in issue23815).

We should document this catch and a way to avoid it (explicitly set tp_new to 
NULL for the result of PyType_FromSpec()). Both the C API documentation and PEP 
384 should be updated. Would be great if standard examples include a case of 
non-callable heap type.

As option we can introduce more handy way to set tp_new to NULL by adding 
{Py_tp_new, NULL} to slots array (currently this doesn't have any effect). But 
this is new feature.

--
assignee: docs@python
components: Documentation
messages: 265152
nosy: docs@python, loewis, serhiy.storchaka
priority: high
severity: normal
status: open
title: The danger of PyType_FromSpec()
type: security
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



[issue19717] resolve() fails when the path doesn't exist

2016-05-08 Thread Davide Rizzo

Changes by Davide Rizzo :


--
nosy: +davide.rizzo

___
Python tracker 

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



[issue26798] add BLAKE2 to hashlib

2016-05-08 Thread Christian Heimes

Christian Heimes added the comment:

Thanks for your review, Dmitry.

I have replaced verify() with compare_digest().

Python requires a C89 compatible compiler and 32bit architecture. C89 doesn't 
mandate 64bit integers. As far as I remember there is (or was) one buildbot 
with a compiler, that doesn't have 64 ints on an old SPARC system. All major 
platforms have 64bit ints. I might modify the implementation when the patch has 
landed.

#self.assertIn(h.name, self.supported_hash_names)
I now check for guaranteed and eventually supported hashes.

SSE is enabled on X64_86. I forgot to remove the comments.


The test suite is missing tests for salt, personal and tree hashing. I have 
asked Zooko and JPA for vectors.

--
Added file: 
http://bugs.python.org/file42783/BLAKE2-hash-algorithm-for-CPython-2.patch

___
Python tracker 

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



[issue23815] Segmentation fault when create _tkinter objects

2016-05-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cd25508c62fc by Serhiy Storchaka in branch '3.5':
Issue #23815: Fixed crashes related to directly created instances of types in
https://hg.python.org/cpython/rev/cd25508c62fc

New changeset 1c6326e81c33 by Serhiy Storchaka in branch 'default':
Issue #23815: Fixed crashes related to directly created instances of types in
https://hg.python.org/cpython/rev/1c6326e81c33

--
nosy: +python-dev

___
Python tracker 

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



[issue26976] pathlib equivalent for os.path.realpath()

2016-05-08 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +pitrou

___
Python tracker 

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



[issue26978] Implement pathlib.Path.link (Using os.link)

2016-05-08 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +pitrou
type:  -> enhancement

___
Python tracker 

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



[issue26978] Implement pathlib.Path.link (Using os.link)

2016-05-08 Thread Ram Rachum

Changes by Ram Rachum :


--
components: Library (Lib)
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Implement pathlib.Path.link (Using os.link)
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



[issue26974] Crash in Decimal.from_float

2016-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The second patch converts an instance of float subclass to exact float. 
Disadvantages are that this changes behavior ignoring overriding 
as_integer_ratio() and __abs__() and slightly slows down Python implementation. 
Advantages are that this fixes also issue26975 and slightly speeds up C 
implementation.

--
stage:  -> patch review
Added file: 
http://bugs.python.org/file42782/decimal_from_float_exact_float.patch

___
Python tracker 

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



[issue23640] int.from_bytes() is broken for subclasses

2016-05-08 Thread Ethan Furman

Ethan Furman added the comment:

With the patch:

  --> import enum
  --> class Huh(enum.IntEnum):
  ...   blah = 2
  ...
  --> Huh.blah.from_bytes(b'\04', 'big')
  Traceback (most recent call last):
File "", line 1, in 
File "/home/ethan/source/python/issue23640/Lib/enum.py", line 222, in 
__call__
  return cls.__new__(cls, value)
File "/home/ethan/source/python/issue23640/Lib/enum.py", line 457, in 
__new__
  raise ValueError("%r is not a valid %s" % (value, cls.__name__))
  ValueError: 4 is not a valid Huh

This is not the correct behavior.  An IntEnum should act like an int, and in 
cases where it can't and still be an IntEnum, it becomes an int.  But this 
behavior is Enum specific, and I would not expect other int subclasses to need 
or want that behavior.

Also, in cases where class methods are alternate constructors there is no 
requirement that they go through the main __new__/__init__ constructors to do 
their job.

In other words, if IntEnum.from_bytes (which is inherited) is not behaving 
correctly, it is up to IntEnum to fix it -- it is not the job of int, and this 
is not a bug in int.

--

___
Python tracker 

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



[issue23640] int.from_bytes() is broken for subclasses

2016-05-08 Thread Ethan Furman

Ethan Furman added the comment:

I think the classmethod-as-constructor behavior is correct, so it's up to 
IntEnum (or EnumMeta, or foo, or ...), to work around the issue.

--

___
Python tracker 

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



[issue23640] int.from_bytes() is broken for subclasses

2016-05-08 Thread Ethan Furman

Ethan Furman added the comment:

'from_bytes' is a classmethod.  As such, it should return the same type as the 
class it is called on.  If that wasn't the intent it would be a staticmethod 
instead.

It is the responsibility of the subclass to override base class behavior, not 
the other way around.

--

___
Python tracker 

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



[issue26974] Crash in Decimal.from_float

2016-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here are two alternative patches that fix the crash.

The first patch adds checks for as_integer_ratio() result. The only 
disadvantage is that error messages are quite arbitrary and differ from error 
messages in Python version.

--
keywords: +patch
Added file: 
http://bugs.python.org/file42781/decimal_from_float_check_result.patch

___
Python tracker 

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



[issue23228] The tarfile module crashes when tarfile contains a symlink and unpack directory contain it too

2016-05-08 Thread Lars Gustäbel

Lars Gustäbel added the comment:

I suck :-) It is hg revision bb94f6222fef.

--

___
Python tracker 

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



[issue23228] The tarfile module crashes when tarfile contains a symlink and unpack directory contain it too

2016-05-08 Thread Lars Gustäbel

Lars Gustäbel added the comment:

TarFile.makelink() has a fallback mode in case the platform does not support 
links. Instead of a symlink or a hardlink it extracts the file it points to as 
long as it exists in the current archive.

More precisely, makelink() calls os.symlink() and if one of the exceptions in 
the symlink_exception tuple is raised, it goes into fallback mode. r80944 
introduced a regression because it replaced the WindowsError in 
symlink_exception with an OSError which is much less specific than a 
WindowsError. Since that change, the fallback is used everytime an OSError 
occurs, in Michael's case it is a FileExistsError, because the symlink is 
already there.

The attached patch restores the old behavior. This might not be what you 
wanted, Michael, but at least, tarfile no longer crashes.

--
Added file: http://bugs.python.org/file42780/windowserror.diff

___
Python tracker 

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



[issue26855] android: add platform.android_ver()

2016-05-08 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Android framework provides an SDK_INT field [1], which parses the value of 
`ro.build.version.sdk` and defaults to 0 if failed [2]. Should android_ver() 
return an integer for the `sdk` field, too? It simplifies the usage in #26935 
and similar ones.

[1] 
https://android.googlesource.com/platform/frameworks/base/+/e8579b12a3c5be5fef25fc5a1c8c2c9d43e49347/core/java/android/os/Build.java#183
[2] 
https://android.googlesource.com/platform/frameworks/base/+/e8579b12a3c5be5fef25fc5a1c8c2c9d43e49347/core/jni/android_os_SystemProperties.cpp#66

--

___
Python tracker 

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



[issue26935] android: test_os fails

2016-05-08 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

My implementation at #26855 returns a tuple of strings like other funcitons, 
including java_ver() and mac_ver(). Maybe it requires a change.

--
nosy: +Chi Hsuan Yen

___
Python tracker 

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



[issue26282] Add support for partial keyword arguments in extension functions

2016-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

On new patch applied Martin's suggestions, added entities in What's New and 
NEWS, added a reference to the glossary, and improved error message.

--
Added file: 
http://bugs.python.org/file42779/pyarg_parse_positional_only_and_keywords_3.patch

___
Python tracker 

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



[issue26975] Decimal.from_float works incorrectly for non-binary floats

2016-05-08 Thread Mark Dickinson

Mark Dickinson added the comment:

> I see following ways to resolve this issue:

I don't think 4. is an option: for input of exact type float, from_float should 
continue to produce the exact value of the float, rather than an approximation 
to that exact value. There's code out there that depends on this behaviour. 
Options 1 through 3 all seem reasonable to me.

--

___
Python tracker 

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



[issue26798] add BLAKE2 to hashlib

2016-05-08 Thread Dmitry Chestnykh

Dmitry Chestnykh added the comment:

Christian: yes, and I'm also happy that you kept the drawing of hash tree, as 
it helps a lot with understanding of terminology.

I had a quick look at the patch and it looks good to me.

Some comments, which you can ignore:

In keyed hashing example there's:

+>>> def verify(cookie, sig):
+... good_sig = sign(cookie)
+... if len(sig) != len(good_sig):
+...  return False
+... # Use constant-time comparison to avoid timing attacks.
+... result = 0
+... for x, y in zip(sig, good_sig):
+... result |= ord(x) ^ ord(y)
+... return result == 0

Perhaps, you can replace comparison with hmac.compare_digest(sig, goodsig) now 
that we have it in Python.

+*Salted hashing* (or just hashing) with BLAKE2 or any other general-purpose
+cryptographic hash function, such as SHA-256, is not suitable for hashing
+passwords.  See `BLAKE2 FAQ `_ for more
+information.

Maybe also point readers to hashlib.html#key-derivation


+On platforms with support for 64bit integer types (some 32bit platforms,
+all 64bit platforms), blake2b and blake2s are supported.

Theoretically, blake2s shouldn't require 64bit int, reference code only uses it 
for sizes -- is this something worth fixing? Are there platforms that have 
uint32_t, but not uint64_t?


@@ -162,7 +192,7 @@ class HashLibTestCase(unittest.TestCase):
 for cons in self.hash_constructors:
 h = cons()
 self.assertIsInstance(h.name, str)
-self.assertIn(h.name, self.supported_hash_names)
+#self.assertIn(h.name, self.supported_hash_names)
 self.assertEqual(h.name, hashlib.new(h.name).name)


Was this commented-out on purpose? Also, in setup.py:

+#if os.uname().machine == "x86_64":
+# Every x86_64 machine has at least SSE2.
+#blake2_macros.append(('BLAKE2_USE_SSE', '1'))

--
nosy: +dchest

___
Python tracker 

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



[issue26975] Decimal.from_float works incorrectly for non-binary floats

2016-05-08 Thread Stefan Krah

Stefan Krah added the comment:

As Mark hinted at, many people would say there is no issue at all.
Subclassing like that often breaks the Liskov Substitution Principle.

For more information, see e.g.:

  http://okmij.org/ftp/Computation/Subtyping/


"Alas, LSP when considered from an OOP point of view is undecidable. You cannot 
count on a compiler for help in pointing out an error. You cannot rely on 
regression tests either. It's manual work -- you have to see the problem"

--

___
Python tracker 

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



[issue22274] subprocess.Popen(stderr=STDOUT) fails to redirect subprocess stderr to stdout

2016-05-08 Thread Martin Panter

Martin Panter added the comment:

I think this patch is pretty good. I will try to commit it in the next few days.

--
nosy: +martin.panter
versions: +Python 2.7, 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



[issue26975] Decimal.from_float works incorrectly for non-binary floats

2016-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Once I was going to propose to make as_integer_ratio() returning a pair (n, d) 
with minimal positive d that n/d (as float) is exactly equal to the original 
float. I think this is legitimate implementation and doesn't contradict the 
documentation.

I see following ways to resolve this issue:

1. Ignore it.

2. Ignore methods overriding:
2a) either convert float subclass to exact float with known behavior;
2b) or directly call static float.__abs__() and float.as_integer_ratio() 
instead of resolving dynamic methods.

3. Check that the denominator is a power of 2 and raise error otherwise.

4. Implement different different algorithm. Returns decimal n / 10**k with 
minimal k that after converting to float is exactly equal to the original float.

Most of these solutions will automatically fix issue26974, so it doesn't need 
special fix.

--

___
Python tracker 

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



[issue26798] add BLAKE2 to hashlib

2016-05-08 Thread Christian Heimes

Christian Heimes added the comment:

Here is my first patch. I have tested it on X86_64 (m64 and m32) and ARMv7. It 
should compile on Windows but I don't have a working Windows box on my box. 

Dmitry, I have copied your documentation. Are you fine with that?

TODO:

- set BLAKE2_USE_SSE on win32 X86_64
- more test vectorss for advanced use cases (salt, personal, tree hashing)

--
keywords: +patch
stage: needs patch -> patch review
Added file: 
http://bugs.python.org/file42778/BLAKE2-hash-algorithm-for-CPython.patch

___
Python tracker 

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



[issue22274] subprocess.Popen(stderr=STDOUT) fails to redirect subprocess stderr to stdout

2016-05-08 Thread Akira Li

Akira Li added the comment:

Updated the patch to address vadmium's review comments.

--
versions:  -Python 3.4
Added file: 
http://bugs.python.org/file42777/subprocess-stderr_redirect_with_no_stdout_redirect-2.diff

___
Python tracker 

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



[issue26976] pathlib equivalent for os.path.realpath()

2016-05-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is a duplicate of issue19717.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> resolve() fails when the path doesn't exist

___
Python tracker 

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



[issue26977] Unnecessary line in statistics.pvariance

2016-05-08 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> fixed

___
Python tracker 

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



[issue26977] Unnecessary line in statistics.pvariance

2016-05-08 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Thanks Ian! I can't believe I looked at that function earlier today and 
couldn't see that!

--
nosy: +steven.daprano
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



[issue26977] Unnecessary line in statistics.pvariance

2016-05-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2bf4a02f3570 by Steven D'Aprano in branch 'default':
Issue 26977, remove unneeded line in pvariance (duplicate call to _ss).
https://hg.python.org/cpython/rev/2bf4a02f3570

--
nosy: +python-dev

___
Python tracker 

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



[issue26512] Vocabulary: Using "integral" in library/stdtypes.html

2016-05-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9e29034a41fa by Martin Panter in branch '3.5':
Issue #26512: Clarify Integral; tidy up table of rounding functions
https://hg.python.org/cpython/rev/9e29034a41fa

New changeset a8883951b2ff by Martin Panter in branch 'default':
Issue #26512: Merge rounding doc from 3.5
https://hg.python.org/cpython/rev/a8883951b2ff

New changeset a69805edfadd by Martin Panter in branch '2.7':
Issue #26512: Clarify Integral; tidy up table of rounding functions
https://hg.python.org/cpython/rev/a69805edfadd

--
nosy: +python-dev

___
Python tracker 

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



[issue26977] Unnecessary line in statistics.pvariance

2016-05-08 Thread Ian Foote

New submission from Ian Foote:

In statistics.pvariance, the sum of squares helper function (_ss) is called 
twice and the first return value is unused: 
https://github.com/python/cpython/blob/9043c80b0daaddb5bff1e37432d503910506727f/Lib/statistics.py#L596

--
components: Library (Lib)
messages: 265131
nosy: Ian Foote
priority: normal
severity: normal
status: open
title: Unnecessary line in statistics.pvariance
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



[issue26924] android: test_concurrent_futures fails

2016-05-08 Thread Xavier de Gaye

Xavier de Gaye added the comment:

> #  undef sem_open

I meant of course:

#  undef HAVE_SEM_OPEN

--

___
Python tracker 

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



[issue26976] pathlib equivalent for os.path.realpath()

2016-05-08 Thread Davide Rizzo

Changes by Davide Rizzo :


--
type:  -> enhancement

___
Python tracker 

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



[issue26924] android: test_concurrent_futures fails

2016-05-08 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Undefining the SEM_* macros in multiprocessing.h when __ANDROID__ is set, would 
allow for an easier update when those functions become implemented at a future 
API level. The __ANDROID_API__ macro can be used for that purpose. For example, 
if this happens at API 24, this could be a changed to:

#if defined(__ANDROID__)
# include 
# if __ANDROID_API__ < 24
#  undef sem_open
#  ...
# endif
#endif

--

___
Python tracker 

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



[issue26976] pathlib equivalent for os.path.realpath()

2016-05-08 Thread Davide Rizzo

New submission from Davide Rizzo:

pathlib doesn't provide an exact replacement for os.path.realpath().

Path.resolve() is the closest equivalent, but differs in behavior in one case: 
when the path does not exist.

>>> os.path.realpath('/foo')
'/foo'

>>> Path('/foo').resolve()
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/pathlib.py",
 line 1094, in resolve
s = self._flavour.resolve(self)
  File 
"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/pathlib.py",
 line 330, in resolve
return _resolve(base, str(path)) or sep
  File 
"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/pathlib.py",
 line 315, in _resolve
target = accessor.readlink(newpath)
  File 
"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/pathlib.py",
 line 422, in readlink
return os.readlink(path)
FileNotFoundError: [Errno 2] No such file or directory: '/foo'

This impairs pathlib usefulness to sanitize user input when I am about to 
create a file or a directory. The file does not exist yet, and pathlib doesn't 
provide an easy mean to validate whether the provided input is safe.

--
components: Library (Lib)
messages: 265128
nosy: davide.rizzo
priority: normal
severity: normal
status: open
title: pathlib equivalent for os.path.realpath()
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



[issue26935] android: test_os fails

2016-05-08 Thread Martin Panter

Martin Panter added the comment:

Yes something like that should do the trick

--
components: +Tests -Cross-Build, Library (Lib)
dependencies: +android: add platform.android_ver()

___
Python tracker 

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



[issue11063] uuid.py module import has heavy side effects

2016-05-08 Thread Martin Panter

Martin Panter added the comment:

There is already Issue 20519 for that, although it looks like the proposed 
patch keeps ctypes as a fall-back. (My interest here is only theoretical.)

--

___
Python tracker 

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



[issue16113] Add SHA-3 and SHAKE (Keccak) support

2016-05-08 Thread Christian Heimes

Christian Heimes added the comment:

Larry,
I'm with Gregory. There is no good reason to add SHA3 to Python 2.7. The SHA-2 
family is still safe. Besides I'd rather add BLAKE2 to Python 2.7. It's much 
faster and more versatile than SHA3.

Antoine,
SHAKEs are XOF (extensible output function). NIST has standardized the XOFs but 
not yet approved them as replacement for other constructs. They are useful for 
signatures or as a simple stream cipher. The SHAKEs were low hanging fruits to 
implement, so I included them.

--

___
Python tracker 

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



[issue26935] android: test_os fails

2016-05-08 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Since this seems to be fixed in a version of android that is more recent that 
API 21, maybe use the value of 'sdk.release' when platform.android_ver() is 
available after issue #26855 is fixed, with for example, if this is fixed at 
API 23:

sdk_release = platform.android_ver()[1]
if new_fd != fd or not sdk_release or sdk_release >= 23:

--

___
Python tracker 

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



[issue26975] Decimal.from_float works incorrectly for non-binary floats

2016-05-08 Thread Stefan Krah

Stefan Krah added the comment:

It seems to work correctly here for non-binary floats:

>>> from _pydecimal import Decimal
>>> Decimal.from_float(Decimal("1.2"))
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.6/_pydecimal.py", line 739, in from_float
raise TypeError("argument must be int or float.")
TypeError: argument must be int or float.


I think we should not support strange inheritance hierarchies that
break the expected return values of parent class methods.

--

___
Python tracker 

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



[issue11063] uuid.py module import has heavy side effects

2016-05-08 Thread Christian Heimes

Christian Heimes added the comment:

It sounds like ctypes is causing you some headache. How about we get rid of 
ctypes for uuid and replace it with a simple implementation in C instead? 
Autoconf (configure) can take care of the library detection easily.

--

___
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-05-08 Thread Martin Panter

Martin Panter added the comment:

There’s still something funny about your patches: the last one has a bit of 
configure script at the end of the posixmodule.c diff.

One other thing I thought of: “in” is not a practical keyword argument name in 
Python, because it is a reserved word. Yes, sendfile(**{"in": ...}) is already 
there, but I think we should find some other name for copy_file_range() before 
it is too late. Some ideas:

copy_file_range(input, output, count, offset_in, offset_out, flags)  # Spell 
them out
copy_file_range(fd_in, fd_out, len, off_in, off_out, flags)  # Direct from man 
page
copy_file_range(src, dst, count, offset_src, offset_dst, flags)  # Like 
os.replace(), shutil.copyfile(), etc
copy_file_range(fsrc, fdst, count, offset_src, offset_dst, flags)  # Like 
shutil.copyfileobj()

My favourites are probably “input”, or “src”.

--

___
Python tracker 

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



[issue26282] Add support for partial keyword arguments in extension functions

2016-05-08 Thread Martin Panter

Martin Panter added the comment:

I made some suggestions in the documentation. I only skimmed over the C and arg 
clinic code, but there is nothing obviously wrong.

--

___
Python tracker 

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



[issue26870] Unexpected call to readline's add_history in call_readline

2016-05-08 Thread Martin Panter

Martin Panter added the comment:

I left a few minor comments in the code review.

I agree automated testing would be awkward for Readline. It should be possible 
using a pseudoterminal (pty). In fact there is already very basic testing that 
does this in /Lib/test/test_builtin.py, class PtyTests. It only tests the 
input() prompt.

I could have a go at writing a test. I guess pseudocode for a test would look a 
bit like:

def run_pty(script):
[master, slave] = pty.openpty()
with subprocess.Popen(script, stdin=slave, stdout=slave, stderr=slave)
# Read and write concurrently like proc.communicate()
master.write(b"dummy input\r")
return slave.read()

template = """\
import readline
readline.set_auto_history({})
input()
print("History length:", readline.get_current_history_length())
"""

def test_auto_history_enabled(self):
output = run_session(template.format(True))
self.assertIn(b"History length: 1\n", output)

def test_auto_history_disabled(self):
output = run_session(template.format(False))
self.assertIn(b"History length: 0\n", output)

--
stage:  -> patch review
versions:  -Python 2.7, Python 3.5

___
Python tracker 

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



[issue26975] Decimal.from_float works incorrectly for non-binary floats

2016-05-08 Thread Mark Dickinson

Mark Dickinson added the comment:

True. Though having a subclass of float that overrides as_integer_ratio seems a 
fairly unlikely use-case. We could add a check for subclasses of float that the 
denominator is a power of 2 (using the usual trick: a positive integer n is a 
power of 2 if and only if `n & (n-1)` is zero) and raise a suitable error 
otherwise.

I doubt it's worth trying to support arbitrary return values from 
as_integer_ratio. Note that by overriding as_integer_ratio, you're breaking its 
"contract": the docs say

> Return a pair of integers, whose ratio is exactly equal to the original
> float and with a positive denominator.

and you've lost that "exactly equal". I think it's reasonably to get wrong 
results or an exception in that case.

--

___
Python tracker 

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



[issue26973] Dict View binops permit non-set types

2016-05-08 Thread Joshua Morton

Joshua Morton added the comment:

There (seemed to be) consensus between the one or two on topic commenters that 
something was off, although much of the discussion was on a tangent. Although 
on looking back, there was even less discussion than I originally thought. Heh.

My response was going to be very different, however I did some additional 
digging: the `collections.abc.Set` class can be used as a mixin for 
implementing set-likes. In its default implementations of the various binops, 
they will attempt to convert the right hand argument of an operator to the 
correct type, via _from_iterable. This in effect makes the set the special case 
that is more permissive than Set is. 

This strikes me as strange, I'd expect set and Set to be 'the same', or in 
other words a Set to act like a set and vice versa. But it seems that python 
swings toward your intuition and not mine. And the opposite, making set *more* 
permissive also doesn't sit well, nor does it feel necessary.

--

___
Python tracker 

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



[issue26975] Decimal.from_float works incorrectly for non-binary floats

2016-05-08 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Decimal.from_float() works correctly only if the denominator of 
as_integer_ratio() of argument is the power of two. Example:

>>> from decimal import Decimal
>>> class DecimalFloat(float):
... def as_integer_ratio(self):
... return Decimal(str(self)).as_integer_ratio()
... def __abs__(self):
... return self
... 
>>> DecimalFloat(1.2).as_integer_ratio()
(6, 5)
>>> Decimal.from_float(DecimalFloat(1.2))
Decimal('1.50')

--
components: Extension Modules, Library (Lib)
messages: 265116
nosy: facundobatista, mark.dickinson, rhettinger, serhiy.storchaka, skrah
priority: normal
severity: normal
status: open
title: Decimal.from_float works incorrectly for non-binary floats
type: behavior
versions: Python 2.7, 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



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

2016-05-08 Thread Martin Panter

Martin Panter added the comment:

Your new patch calls find_library() internally in CDLL(); why? My understanding 
is CDLL() is a fairly lightweight wrapper around the dlopen() call. On Linux, 
you either pass a full library file name, or an SO-name. Both these strings can 
be discovered for compiled objects using e.g.:

$ ldd build/lib.linux-x86_64-2.7-pydebug/_ssl.so
linux-vdso.so.1 (0x7fff567fe000)
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x7f598474c000)
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x7f59842d4000)
. . .

So in Python, the SO-name or full path can be used, but not the compile-time 
name, unless you first pass it through find_library():

>>> CDLL("libcrypto.so.1.0.0")  # soname

>>> CDLL("/usr/lib/libcrypto.so.1.0.0")  # Full path

>>> CDLL("crypto")  # Compile-time name
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: crypto: cannot open shared object file: No such file or directory
>>> find_library("crypto")  # Some people pass the result of this to CDLL()
'libcrypto.so.1.0.0'

--

___
Python tracker 

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



[issue26973] Dict View binops permit non-set types

2016-05-08 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On Sun, May 08, 2016 at 04:24:59AM +, Joshua Morton wrote:

> Following the comments in python ideas [1] [...]
> 
> [1] https://mail.python.org/pipermail/python-ideas/2016-April/039469.html

Am I missing something? I don't see anything resembling a consensus that 
the behaviour of dict views is a bug in that thread, in fact I hardly 
see any discussion about this specific behaviour. (Other related topics 
are discussed in more depth.)

I don't think it is a bug for views to permit non-set arguments with 
binops:

py> {'a': 1, 'b': 2}.keys() & ['a', 'c']
{'a'}

I think it is a matter of taste. My own taste tells me that sets should 
be more restrictive, only accepting other [frozen]sets or subclasses, 
but views should be less restrictive, and perform more duck-typing of 
"set-like" objects, including lists. No, I can't justify it, except by 
an appeal to status quo: that's how it is now, and I don't think that 
changing it is worth breaking backwards compatibility.

--
nosy: +steven.daprano

___
Python tracker 

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