Ben Mather | 25 Oct 22:41 2014

[issue22729] `wait` and `as_completed` depend on private api


New submission from Ben Mather:

Adds `remove_done_callback` to `Future` object, removes `_waiters` attribute, and re-implements
`wait` and `as_completed` using callbacks.

This makes it possible to extend or replace `Future` without having to mimic its private `_waiters` interface.

Currently waiters and callbacks are triggered at different points after a cancel (waiters in
`set_condition_and_notify_cancel` and callbacks in `cancel`.)  This is a problem as it means that
implementing `wait` and `as_completed` using `add_done_callback` will result in a behaviour change
unless the behaviour of `add_done_callback` is changed instead. 

I don't believe the current behaviour is as documented anyway so I'm not sure if this is a problem.  See issue 22630.

I am a little uncertain about the O(n) implementation of `remove_done_callback` but can't imagine a
situation where it would be a problem.

----------
components: Library (Lib)
files: non-magic-waiters.patch
keywords: patch
messages: 230016
nosy: bwhmather
priority: normal
severity: normal
status: open
title: `wait` and `as_completed` depend on private api
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6
(Continue reading)

Antoine Pitrou | 25 Oct 22:26 2014

[issue22728] Deprecate spurious benchmarks


New submission from Antoine Pitrou:

"iterative_count" and "threaded_count" are really uninteresting benchmarks, inherited from Dave
Beazley's GIL experiments. I suggest to deprecate them and remove from the "all" and "2n3" sets. Patch attached.

----------
components: Benchmarks
files: deprecated.patch
keywords: patch
messages: 230015
nosy: pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: Deprecate spurious benchmarks
type: enhancement
Added file: http://bugs.python.org/file37015/deprecated.patch

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22728>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

Antoine Pitrou | 25 Oct 21:34 2014

[issue22727] Improve benchmarks precision


New submission from Antoine Pitrou:

This patch tries to improve precision of benchmarks in the benchmark suite by two measures:
- select the best timer for the pair of interpreters (i.e. perf_counter() if possible)
- make hashing deterministic to avoid fluctuations between runs

----------
components: Benchmarks
files: precision.patch
keywords: patch
messages: 230011
nosy: brett.cannon, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Improve benchmarks precision
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file37014/precision.patch

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22727>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

(Continue reading)

Terry J. Reedy | 25 Oct 06:46 2014

[issue22726] Idle: add help to config dialogs


New submission from Terry J. Reedy:

At one time, ConfigDialog was given a do-nothing Help button.  It was diabled a couple of years ago.  This
patch restores it for both config dialogs, displaying a text appropriate for both.  There are separate
functions in anticipation of dialog-specific content.  For both, there is the issue of when changes take
effect (#22707).  For extensions, there might be extension-specific help (#22705).

----------
assignee: terry.reedy
files:  <at> config-help-34.diff
keywords: patch
messages: 229981
nosy: sahutd, terry.reedy
priority: normal
severity: normal
stage: patch review
status: open
title: Idle: add help to config dialogs
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file37010/ <at> config-help-34.diff

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22726>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org
(Continue reading)

Van Ly | 25 Oct 05:43 2014

[issue22725] improve documentation for enumerate() (built-in function)


New submission from Van Ly:

The existing documentation is confusing. 

— improve wording as follows

enumerate(sequence, start=0)

Returns pairings of index into sequence[link to glossary.html#term-sequence] with the object at that
index in the sequence.

— wording as found in v.2.7.5

enumerate(sequence, start=0)

Return an enumerate object. sequence must be a sequence, an iterator, or some other object which supports
iteration. The next() method of the iterator returned by enumerate() returns a tuple containing a count
(from start which defaults to 0) and the values obtained from iterating over sequence:

----------
assignee: docs <at> python
components: Documentation
messages: 229979
nosy: docs <at> python, vy0123
priority: normal
severity: normal
status: open
title: improve documentation for enumerate() (built-in function)
type: enhancement
(Continue reading)

Benedikt Morbach | 25 Oct 01:52 2014

[issue22724] byte-compile fails for cross-builds


New submission from Benedikt Morbach:

For cross-builds the byte-compiling and 2to3 Grammar generation fail.

This is because PYTHONPATH/sys.path includes 'build/lib.$PLATFORM', in which the compiled .so modules reside.
The host python obviously barfs on those, as they are compiled for a different architecture.

However, this directory also contains _sysconfigdata.py, which is needed at all times.

A possible fix would be to separate those two.

----------
components: Cross-Build
messages: 229969
nosy: Benedikt.Morbach
priority: normal
severity: normal
status: open
title: byte-compile fails for cross-builds
type: compile error
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22724>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org
(Continue reading)

Buck Golemon | 24 Oct 21:53 2014

[issue22723] visited-link styling is not accessible


New submission from Buck Golemon:

The color needs adjusted such that it has at least 3:1 luminance contrast versus the surrounding non-link
text. (See "non-inheritable" https://docs.python.org/3/library/os.html#os.dup)

See also:
 * http://www.w3.org/TR/WCAG20/#visual-audio-contrast-without-color
 * http://www.w3.org/WAI/WCAG20/Techniques/working-examples/G183/link-contrast.html

Given that the surrounding text is #222, the a:visited color should be bumped from #30306f to #6363bb in
order to meet the 3:1 luminance-contrast guideline while preserving the hue and saturation.

By the same calculation, the un-visited links are slightly too dark and should be bumped from #00608f to #0072aa

Validation was done here: http://juicystudio.com/services/luminositycontrastratio.php

Luminance adjustments done here: http://colorizer.org/

----------
assignee: docs <at> python
components: Documentation
messages: 229952
nosy: bukzor, docs <at> python
priority: normal
severity: normal
status: open
title: visited-link styling is not accessible

_______________________________________
(Continue reading)

Buck Golemon | 24 Oct 20:25 2014

[issue22722] inheritable pipes are unwieldy without os.pipe2


New submission from Buck Golemon:

In order to make an inheritable pipe, the code is quite a bit different between posixes that implement pipe2
and those that don't (osx, mainly). I believe the officially-supported path is to call os.pipe() then
os.setinheritable(). This seems objectionable since set_inheritable() code is invoked twice, where
I'd prefer to invoke it zero times (or at most once).

Would it be acceptable to implement a pipe2 shim for those platforms?
If so, I'll (attempt to) provide a patch.

Alternatively, can we change the signature of os.pipe() to os.pipe(flags=O_CLOEXEC) ?  In my opinion,
such a function could be implemented via pipe2 on those platforms that provide it, obviating any need for
an os.pipe2.

Please tell me which patch to provide, if any.

----------
messages: 229947
nosy: bukzor
priority: normal
severity: normal
status: open
title: inheritable pipes are unwieldy without os.pipe2

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22722>
_______________________________________
_______________________________________________
(Continue reading)

Serhiy Storchaka | 24 Oct 19:00 2014

[issue22721] pprint output for sets and dicts is not stable


New submission from Serhiy Storchaka:

pprint() sorts the content of sets and dicts in order to get stable output which doesn't depend on iteration
order of set or dict, which depend not only from values of elements, but also from set or dict history.

But in some cases the output is different for equal sets or dicts which differs only by their history.

>>> import pprint
>>> class A:  # string 'A' < 'int'
...     def __lt__(self, other): return False
...     def __gt__(self, other): return self != other
...     def __le__(self, other): return self == other
...     def __ge__(self, other): return True
...     def __eq__(self, other): return self is other
...     def __ne__(self, other): return self is not other
...     def __hash__(self): return 1  # == hash(1)
... 
>>> a = A()
>>> sorted([1, a])
[1, <__main__.A object at 0xb700c64c>]
>>> sorted([a, 1])
[1, <__main__.A object at 0xb700c64c>]
>>> # set
>>> pprint.pprint({1, a})
{<__main__.A object at 0xb700c64c>, 1}
>>> pprint.pprint({a, 1})
{1, <__main__.A object at 0xb700c64c>}
>>> # dict
>>> pprint.pprint({1: 1, a: 1})
(Continue reading)

kg*2 | 24 Oct 18:34 2014

[issue22720] Obscure error w/ windows online-only file


New submission from kg*2:

Windows has integrated onedrive into their os. A feature of onedrive is allowing users to browse files that
aren't downloaded onto their computer. os.listdir will return the items, but when they are opened for
read/writing it throws IOError[22]: invalid mode or file name. This error was not particularly helpful
for this situation, as both the mode and the filename looked correct. Maybe a more specific error for this
case would be help?

----------
components: IO
messages: 229941
nosy: kg*2
priority: normal
severity: normal
status: open
title: Obscure error w/ windows online-only file
type: enhancement
versions: Python 2.7

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22720>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

Aaron | 24 Oct 18:00 2014

[issue22719] os.path.isfile & os.path.exists but in while loop


New submission from Aaron:

When using os.path.isfile() and os.path.exists() in a while loop under certain conditions,
os.path.isfile() returns True for paths that do not actually exist.

Conditions:
The folder "C:\Users\EAARHOS\Desktop\Python Review" exists, as do the files
"C:\Users\EAARHOS\Desktop\Python Review\baseExcel.py" and "C:\Users\EAARHOS\Desktop\Python
Review\baseExcel.py.bak". (Note that I also tested this on a path that contained no spaces, and got the
same results.)

Code:
>>> bak_path = r"C:\Users\EAARHOS\Desktop\Python Review\baseExcel.py"
>>> while os.path.isfile(bak_path):
...     bak_path += '.bak'
...     if not os.path.isfile(bak_path):
...         break
Traceback (most recent call last):
  File "<interactive input>", line 3, in <module>
  File "C:\Installs\Python33\Lib\genericpath.py", line 29, in isfile
    st = os.stat(path)
ValueError: path too long for Windows
>>> os.path.isfile(r"C:\Users\EAARHOS\Desktop\Python Review\baseExcel.py.bak.bak")
False
>>> 

>>> bak_path = r"C:\Users\EAARHOS\Desktop\Python Review\baseExcel.py"
>>> while os.path.exists(bak_path):
...     bak_path += '.bak'
(Continue reading)


Gmane