[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-08-24 Thread INADA Naoki

Changes by INADA Naoki :


--
pull_requests: +3236

___
Python tracker 

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



[issue31095] Checking all tp_dealloc with Py_TPFLAGS_HAVE_GC

2017-08-24 Thread INADA Naoki

INADA Naoki added the comment:

I opened backport PR for 3.6, 2.7 and 3.5.

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



[issue31267] threading.Timer object is affected by changes to system time

2017-08-24 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo

___
Python tracker 

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



[issue31268] Inconsistent socket timeout exception

2017-08-24 Thread desbma

New submission from desbma:

When trying to connect a classic TCP socket to a non reachable peer, the 
exception reported is inconsistent if the socket has a timeout set.

See the attached program, on my system (Arch Linux with Linux 4.9 & Python 
3.6.2) it outputs:

timeout timed out
timeout timed out
timeout timed out
OSError [Errno 113] No route to host
timeout timed out
timeout timed out
timeout timed out
OSError [Errno 113] No route to host
timeout timed out
timeout timed out
timeout timed out
OSError [Errno 113] No route to host
timeout timed out
timeout timed out
timeout timed out
OSError [Errno 113] No route to host
timeout timed out
timeout timed out
timeout timed out
OSError [Errno 113] No route to host

I expect one of the two exceptions to be thrown every time, not a mix of both.

Thank you

--
components: Library (Lib)
files: socket_timeout.py
messages: 300779
nosy: desbma
priority: normal
severity: normal
status: open
title: Inconsistent socket timeout exception
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file47098/socket_timeout.py

___
Python tracker 

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



[issue26256] Fast decimalisation and conversion to other bases

2017-08-24 Thread Stefan Krah

Stefan Krah added the comment:

pypy-5.8.0-beta0 (Python 3.5.3) is using a very nicely written CFFI wrapper for 
libmpdec, so it also has the fast bignums.

--

___
Python tracker 

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



[issue26256] Fast decimalisation and conversion to other bases

2017-08-24 Thread Stefan Krah

Stefan Krah added the comment:

What needs to be mentioned though is that the context has to be set
for unrounded calculations:

c = getcontext()
c.prec = MAX_PREC
c.Emax = MAX_EMAX
c.Emin = MIN_EMIN


Otherwise some people believe that the bignums are just rounded floating point 
arithmetic that is expected to be fast (I've seen this misconception somewhere, 
perhaps on Stackoverflow).

--

___
Python tracker 

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



[issue31265] Remove doubly-linked list from C OrderedDict

2017-08-24 Thread INADA Naoki

Changes by INADA Naoki :


--
nosy: +eric.snow

___
Python tracker 

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



[issue31269] bug in islink() and is_simlink()

2017-08-24 Thread Karine

New submission from Karine:

Hi,

I found a problem which can be a bug and want to inform you.

it seems os.islink() and PATH(mypath).is_symlink()  functions doen't work 
correct when there is linked folder inside the path:

For example I have the following path:
a/b/c/test.txt

if my c folder is link these 2 functions will not show that this path is link

Only if i remove test.txt and use a/b/c path is shows that path is link.


Seems these functions checks only last part of given path not full path and 
doesn't find if there is link in somewere inside path and shows not correct 
result.

Interesting to know your opinion regarding it.

--
messages: 300782
nosy: karaV
priority: normal
severity: normal
status: open
title: bug in islink() and is_simlink()
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



[issue31268] Inconsistent socket timeout exception

2017-08-24 Thread R. David Murray

R. David Murray added the comment:

Have you tried the equivalent C program?  I'm guessing this is happening at the 
OS layer and Python is just reporting it.  On my system a timeout of 5 will 
always report the OS error.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue31269] bug in islink() and is_symlink()

2017-08-24 Thread Karine

Changes by Karine :


--
title: bug in islink() and is_simlink() -> bug in islink() and is_symlink()

___
Python tracker 

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



[issue31269] bug in islink() and is_symlink()

2017-08-24 Thread R. David Murray

R. David Murray added the comment:

The docs say, eg: "Return True if the path points to a symbolic link".  The 
path points to a file system object, and it is the object that is being 
checked, not each component of the path used to get to that object.

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



[issue31269] bug in islink() and is_symlink()

2017-08-24 Thread Karine

Karine added the comment:

Hi David

Thanks for support. one question. I couldn't find a function which will check 
full path is link or not. Is there any known function>

>Четверг, 24 августа 2017, 17:38 +04:00 от "R. David Murray" 
>:
>
>
>R. David Murray added the comment:
>
>The docs say, eg: "Return True if the path points to a symbolic link".  The 
>path points to a file system object, and it is the object that is being 
>checked, not each component of the path used to get to that object.
>
>--
>nosy: +r.david.murray
>resolution:  -> not a bug
>stage:  -> resolved
>status: open -> closed
>
>___
>Python tracker < rep...@bugs.python.org >
>< http://bugs.python.org/issue31269 >
>___

--

___
Python tracker 

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



[issue28261] wrong error messages when using PyArg_ParseTuple to parse normal tuples

2017-08-24 Thread Oren Milman

Changes by Oren Milman :


--
pull_requests: +3237

___
Python tracker 

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



[issue31269] bug in islink() and is_symlink()

2017-08-24 Thread R. David Murray

R. David Murray added the comment:

I would phrase that as "check if any of the components of the path are links", 
at which point one "obvious"[*] answer is "any(x.is_symlink() for x in 
[*mypath.parents, mypath])".  If the path is absolute, you could use "not 
(mypath.resolve() == mypath)".

[*] I put that in quotes because it is only obvious once you have a non-trivial 
amount of experience with programming in Python.

--

___
Python tracker 

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



[issue12067] Doc: remove errors about mixed-type comparisons.

2017-08-24 Thread Cheryl Sabella

Changes by Cheryl Sabella :


--
pull_requests: +3238

___
Python tracker 

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



[issue12067] Doc: remove errors about mixed-type comparisons.

2017-08-24 Thread Cheryl Sabella

Cheryl Sabella added the comment:

I've created a PR for the changes to test_compare from v16 of the patch.

--

___
Python tracker 

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



[issue31270] Simplify documentation of itertools.zip_longest

2017-08-24 Thread Raphael Michel

Changes by Raphael Michel :


--
pull_requests: +3239

___
Python tracker 

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



[issue31270] Simplify documentation of itertools.zip_longest

2017-08-24 Thread Raphael Michel

New submission from Raphael Michel:

The documentation given for itertools.zip_longest contains a "roughly 
equivalent" pure-python implementation of the function that is intended to help 
the user understand what zip_longest does on a functional level.

However, the given implementation is very complicated to read for newcomers and 
experienced Python programmers alike, as it uses a custom-defined exception for 
control flow handling, a nested function, a condition that always is true if 
any arguments are passed ("while iterators"), as well as two other non-trivial 
functions from itertools (chain and repeat).

For future reference, this is the currently given implementation:

def zip_longest(*args, **kwds):
# zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-
fillvalue = kwds.get('fillvalue')
iterators = [iter(it) for it in args]

while True:
exhausted = 0
values = []

for it in iterators:
try:
values.append(next(it))
except StopIteration:
values.append(fillvalue)
exhausted += 1

if exhausted < len(args):
yield tuple(values)
else:
break

This is way more complex than necessary to teach the concept of zip_longest. 
With this issue, I will submit a pull request with a new example implementation 
that seems to be the same level of "roughly equivalent" but is much easier to 
read, since it only uses two loops and now complicated flow 

def zip_longest(*args, **kwds):
# zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-
fillvalue = kwds.get('fillvalue')
iterators = [iter(it) for it in args]

while True:
exhausted = 0
values = []

for it in iterators:
try:
values.append(next(it))
except StopIteration:
values.append(fillvalue)
exhausted += 1

if exhausted < len(args):
yield tuple(values)
else:
break


Looking at the C code of the actual implementation, I don't see that any one of 
the two implementations is obviously "more equivalent". I'm unsure about 
performance -- I haven't tried them on that but I don't think that's the point 
of this learning implementation.

I ran all tests from Lib/test/test_itertools.py against both the old and the 
new implementation. The new implementation fails at 3 tests, while the old 
implementation failed at four. Two of the remaining failures are related to 
TypeErrors not being thrown on invalid input, one of them is related to 
pickling the resulting object. I believe all three of them are fine to ignore 
in this sample, as it is not relevant to the documentation purpose.

Therefore, I believe the documentation should be changed like suggested. I'd be 
happy for any feedback or further ideas to improve its readability!

--
assignee: docs@python
components: Documentation
messages: 300788
nosy: docs@python, rami
priority: normal
severity: normal
status: open
title: Simplify documentation of itertools.zip_longest
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue31254] WeakKeyDictionary/Mapping doesn't call __missing__

2017-08-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

If someone wants to submit a PR, it would help judge the complexity and 
fragility of adding support for this.  I cannot think of any problem upfront 
myself, but you're right that weak containers have been very difficult to make 
robust against various conditions (and it's probably not over yet).

--
nosy: +pitrou

___
Python tracker 

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



[issue31270] Simplify documentation of itertools.zip_longest

2017-08-24 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


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



[issue31270] Simplify documentation of itertools.zip_longest

2017-08-24 Thread Raphael Michel

Raphael Michel added the comment:

I just noticed that in my post I accidentally pasted MY implementation twice 
instead of the old one, sorry for that. Here's the old one for quick comparison:

class ZipExhausted(Exception):
pass

def zip_longest(*args, **kwds):
# zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-
fillvalue = kwds.get('fillvalue')
counter = len(args) - 1
def sentinel():
nonlocal counter
if not counter:
raise ZipExhausted
counter -= 1
yield fillvalue
fillers = repeat(fillvalue)
iterators = [chain(it, sentinel(), fillers) for it in args]
try:
while iterators:
yield tuple(map(next, iterators))
except ZipExhausted:
pass

--

___
Python tracker 

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



[issue23835] configparser does not convert defaults to strings

2017-08-24 Thread Łukasz Langa

Łukasz Langa added the comment:


New changeset a5fab17fc11433b2418f626dc51e8a3d07b198ca by Łukasz Langa in 
branch 'master':
bpo-23835: Restore legacy defaults= behavior for RawConfigParser (#3191)
https://github.com/python/cpython/commit/a5fab17fc11433b2418f626dc51e8a3d07b198ca


--

___
Python tracker 

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



[issue28261] wrong error messages when using PyArg_ParseTuple to parse normal tuples

2017-08-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 13614e375cc3637cf1311733d453df6107e964ea by Serhiy Storchaka 
(Oren Milman) in branch 'master':
bpo-28261: fix err msgs where PyArg_ParseTuple is used to parse normal tuples 
(leftovers) (#3198)
https://github.com/python/cpython/commit/13614e375cc3637cf1311733d453df6107e964ea


--

___
Python tracker 

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



[issue27099] IDLE: turn builting extensions into regular modules

2017-08-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The main refactoring of ConfigDialog into multiple classes is done.  Since you 
kept this patch up to date with the changes, I will review it next, before 
making further changing to individual tab pages.

On problem with implementing some features as extensions is that associated 
keybindings are global to all keysets, instead of being specific to one keyset. 
 This meant that the defaults were necessarily the same for Windows, *nix, and 
OSX.  (Not necessarily bad, but inflexible.)  This means that any change 
changes the supposedly fixed built-in keysets and that users cannot try out 
different bindings in different custom keysets.  This strikes me a  something 
of a bug, so I am looking more favorably at moving all keybindings (other than 
true, 3rd-party extensions) to config-keys.def/cfg.

--

___
Python tracker 

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



[issue31254] WeakKeyDictionary/Mapping doesn't call __missing__

2017-08-24 Thread Raymond Hettinger

Raymond Hettinger added the comment:

We should still ask about use cases though.  Without a motivating use case, why 
churn the code, complexify the API (possibly making it more tricky to use), and 
risk introducing bugs?

AFAICT, the OP's sole motivation was "still, it would seem preferable ..." 
which is no more compelling than the usual "it might be nice if ...".  

The weak reference containers have been around for a long time and I don't 
think anyone has ever reported that they actually needed this functionality.

--

___
Python tracker 

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



[issue31270] Simplify documentation of itertools.zip_longest

2017-08-24 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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

___
Python tracker 

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



[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Oren Milman

New submission from Oren Milman:

currently, the following causes an assertion in Modules/_io/textio.c in
_io_TextIOWrapper_write_impl() to fail:
import codecs
import io

class BadEncoder():
def encode(self, dummy):
return 42
def _get_bad_encoder(dummy):
return BadEncoder()

quopri = codecs.lookup("quopri")
quopri._is_text_encoding = True
quopri.incrementalencoder = _get_bad_encoder
t = io.TextIOWrapper(io.BytesIO(b'foo'), encoding="quopri")
t.write('bar')


this is because _io_TextIOWrapper_write_impl() doesn't check whether the value
returned by encoder's encode() is a bytes object.

(I would open a PR to fix that soon.)

--
components: IO
messages: 300795
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: an assertion failure in io.TextIOWrapper.write
type: crash
versions: Python 3.7

___
Python tracker 

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



[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
stage:  -> needs patch

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-08-24 Thread Steve Dower

Steve Dower added the comment:


New changeset de50360ac2fec81dbf733f6c3c739b39a8822a39 by Steve Dower (Oren 
Milman) in branch 'master':
bpo-29741: Update some methods in the _pyio module to also accept integer 
types. Patch by Oren Milman. (#560)
https://github.com/python/cpython/commit/de50360ac2fec81dbf733f6c3c739b39a8822a39


--
nosy: +steve.dower

___
Python tracker 

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



[issue31272] typing module conflicts with __slots__-classes

2017-08-24 Thread Ilia Korvigo

New submission from Ilia Korvigo:

I've got conflicts between Python's typing system and `__slots__`. Here is a 
small reproducible example.

from typing import TypeVar, Generic, Sequence

T = TypeVar("T")

class TestGeneric(Sequence, Generic[T]):
__slots__ = ("test",)

def __init__(self, test: T):
self.test = [test]

def __iter__(self):
return iter(self.test)
def __len__(self):
return len(self.test)

def __contains__(self, item):
return item in self.test

def __getitem__(self, _):
return self.test[0]

Now whenever I try to specify a content type, e.g.

V = TestGeneric[int]

I get 

ValueError: 'test' in __slots__ conflicts with class variable

I use `Generics`  in classes without slots a lot, hence I think this error has 
to be linked to `__slots__`. Moreover, the same class works fine, if you remove 
the `__slots__`

--
components: Library (Lib)
messages: 300797
nosy: grayfall
priority: normal
severity: normal
status: open
title: typing module conflicts with  __slots__-classes
type: behavior
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



[issue27099] IDLE: turn builting extensions into regular modules

2017-08-24 Thread Charles Wohlganger

Charles Wohlganger added the comment:

I am not sure I understand your concern. As part of mainlining the extensions, 
all of their keybindings were moved to config-keys.def . There is nothing to 
prevent users from changing the keybindings or preventing us from making the 
defaults different across the different default key sets.

--

___
Python tracker 

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



[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Oren Milman

Changes by Oren Milman :


--
pull_requests: +3240

___
Python tracker 

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



[issue31270] Simplify documentation of itertools.zip_longest

2017-08-24 Thread R. David Murray

R. David Murray added the comment:

Thanks for wanting to improve the documentation.

Raymond will address this definitively, but unless I'm mistaken part of the 
purpose of the examples is to show how the various itertools can be used.  If 
that is true, then in the context of the overall itertools documentation I 
think the current example has more teaching value than your suggested revision.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue31254] WeakKeyDictionary/Mapping doesn't call __missing__

2017-08-24 Thread Antony Lee

Antony Lee added the comment:

The use case is to generate a mapping of weakly-held objects to unique ids, 
with something like

id_map = WeakKeyDictionaryWithMissing(lambda *, _counter=itertools.count(): 
next(_counter))

Of course, as always when using defaultdict, it is easy enough to instead 
implement this by manually checking if the key is present and store a new id in 
this case -- but this is as well an argument for not having defaultdict in the 
first place.

--

___
Python tracker 

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



[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Vedran Čačić

Vedran Čačić added the comment:

I can't reproduce this on 3.6.0. Is this on 3.7 only?

--
nosy: +veky

___
Python tracker 

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



[issue31273] Unicode support in TestCase.skip

2017-08-24 Thread Nathan Buckner

New submission from Nathan Buckner:

Unicode support for TestCase.skip is broken because the caught SkipTest 
exception is passed through a str call.
except SkipTest as e:
self._addSkip(result, str(e))
Could be fixed with by changing to unicode(e)

--
components: Tests, Unicode
files: issue.txt
messages: 300802
nosy: Nathan Buckner, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: Unicode support in TestCase.skip
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file47099/issue.txt

___
Python tracker 

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



[issue31268] Inconsistent socket timeout exception

2017-08-24 Thread desbma

desbma added the comment:

Yes, you are right: I tried with a small C program, and compared with strace 
log of the Python program.
In both cases poll sometimes returns -1 (error), or sometimes 0 (timeout).

This is a weird behavior (at least for me) of the TCP stack, but clearly Python 
is not the cause so I am closing this issue.

--
resolution:  -> not a bug
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



[issue27099] IDLE: turn builting extensions into regular modules

2017-08-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Before reading the patch, more thoughts on the features, options, and behavior: 
nothing is Shell only; codecontext, rstrip, and runscript are properly limited 
to editors; the others are enabled for both.  I think paragraph could have been 
editor only, but I would not enforce that now.  I want current enable defaults 
to be build-in, with needed disabling handled otherwise.

autocomplete: popupwait is needed, a large value will disable.  (In 
root.after(n, func), a negative delay is the same as no delay.)

codecontext: has multiple bugs, including the usage of 'visible', which should 
no longer be used; see *22703.  I think the actual number of lines should be 
variable, up to numlines.  Implementing that would be another issue, but 
numlines = 0 should disable the feature.  (This is interpreted the same as 
numlines=1 in current IDLE when codecontext is enabled.)  The menu entry should 
continue to toggle code context for the current window, but should not set 
'visible'.

Some sort of distinct highlighting is needed.

Adding new shortcuts, such as for code-context, is not part of this issue.  
There are other menu entries, such as 'Recent files' that need a shortcut just 
as much or more.  This should be a separate issue.

paragraph: max_width is needed.

parenmatch: 'style' is needed. I presume some timer is.  I am not sure why this 
particular instance of an audible signal for error (as opposed to SyntaxError, 
for instance) is needed.

Add a new, distinct highlighting for paren matching should be a separate issue

zoomheight: useful when it works right, but more or less useless on Windows as 
it zooms under the taskbar, obscuring the status bar.  How about on other 
systems?

On Windows 10, pulling the top of the window up to the top of the screen or the 
bottom down to (but not under) the taskbar zooms the opposite border. Pulling 
either border away pulls the opposite away also.

--

___
Python tracker 

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



[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Oren Milman

Oren Milman added the comment:

Just checked on current 3.6 on my Windows 10.
The assertion failes, and it is in line 1337.
oh my.

--

___
Python tracker 

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



[issue31268] Inconsistent socket timeout exception

2017-08-24 Thread R. David Murray

R. David Murray added the comment:

I'm not a networking expert at this level, but I believe what is happening here 
is that the network stack does an arp, and has a timeout waiting for the arp 
response that is longer than your socket timeout.  So at some point its arp 
timeout expires while the socket timeout hasn't, and it reports that there's no 
route to the host and resets its state.  Then on the *next* socket request it 
sends another arp request (because the host may have appeared since the last 
time it checked), and the cycle repeats.   I think this is a reasonable way for 
it to behave when the socket timeout is shorter than the arp response timeout, 
because otherwise you'd either lose the information that there's no route to 
the host, or you'd lose the association between "open the socket" and "send an 
arp".  But like I said, I'm not an expert at the layer 2 stuff.  I suppose in 
theory one could associate arp requests with socket operations one-for-one, but 
that would require more memory and I'm not surprised that
  the network stack doesn't go that route.

--

___
Python tracker 

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



[issue27099] IDLE: turn builting extensions into regular modules

2017-08-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

My 'concern' was in relation to the old situation and why I have become more 
willing to change default behavior.

--

___
Python tracker 

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



[issue22536] subprocess should include filename in FileNotFoundError exception

2017-08-24 Thread Gregory P. Smith

Gregory P. Smith added the comment:


New changeset 8621bb5d93239316f97281826461b85072ff6db7 by Gregory P. Smith in 
branch 'master':
bpo-22536: Set the filename in FileNotFoundError. (#3194)
https://github.com/python/cpython/commit/8621bb5d93239316f97281826461b85072ff6db7


--

___
Python tracker 

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



[issue27099] IDLE: turn builting extensions into regular modules

2017-08-24 Thread Charles Wohlganger

Charles Wohlganger added the comment:

ZoomHeight has been put back into being an extension. This was because 
configdialog assumes autoexpand was an extension, and the idleconf tests all 
need at least one extension to exist to be useful. Zoomheight is pointless in 
almost any modern desktop environment, but it's very useful as an example 
extension and as a model extension for tests.

I'm going to fix autocomplete and paragraph options. I had their options in the 
general tab in an earlier build, but it looks like I accidentally reverted it. 
The rest of the options are in the highlights tab. The bell was in the 
extension before I got to it. Fixing that and whatever bugs are in codecontext 
seems outside the scope of this patch.

--

___
Python tracker 

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



[issue31254] WeakKeyDictionary/Mapping doesn't call __missing__

2017-08-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Of course, as always when using defaultdict, it is easy enough to instead 
> implement this by manually checking if the key is present and store a new id 
> in this case 

Or, better, use setdefault(), since manually checking suffers from a race 
condition in the weak dictionary case.

--

___
Python tracker 

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



[issue31268] Inconsistent socket timeout exception

2017-08-24 Thread desbma

desbma added the comment:

Thanks for the insight.

Well the most logical thing for me for the OS to do, would have been:
1. Send an ARP request
2. At the first poll call, report a timeout if no response was received 
3. Repeat to 2. until the destination is considered unreachable
4. At the next connect call, fire off another ARP request
5. At the next poll call, if the response to the ARP sent in 5 was not 
received, report "No route to host" immediately because it is the last cached 
result (from 3)
6. Always report "No route to host" for the following calls (even if new ARP 
requests are sent)

With "ip -4 neigh" I can see that the neighbor is in FAILED state when the 
OSError error is reported, but immediately goes to INCOMPLETE state at the next 
connect call (because another ARP request is sent).
The behavior is the same with an IPv6 socket. By re-reading the NDP RFC 
(https://tools.ietf.org/html/rfc4861) I can understand why implementations 
behave like that. The RFC does not define the "FAILED" neighbor cache state, so 
"resolution failed" means "neighbor is not in the cache".
Linux has a delayed garbage collection for the neighbor cache, which is why we 
can sometimes see entries in FAILED state, but when a new socket tries to 
connect to the peer, the resolution starts again like nothing happened before.

So it's weird, but it conforms to the standard :)

--

___
Python tracker 

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



[issue30781] IDLE: configdialog -- switch to ttk widgets.

2017-08-24 Thread Cheryl Sabella

Cheryl Sabella added the comment:

I rebased my PR and updated the tests so that they would pass.  I knew 'bg' on 
the frame would be changed, but I was surprised by the 'state' changes.  
'normal' only exists for compatibility and isn't one of the states to check in 
the tests; instead, 'disabled' and '!disabled' set the state and either 
'disabled' appears in the tuple or it doesn't appear.  I suppose I could have 
changed the tests to be assertNotIn.

https://docs.python.org/3/library/tkinter.ttk.html#widget-states

--

___
Python tracker 

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



[issue27099] IDLE: turn builting extensions into regular modules

2017-08-24 Thread Cheryl Sabella

Cheryl Sabella added the comment:

zoomheight is OK on Ubuntu.

--

___
Python tracker 

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



[issue22536] subprocess should include filename in FileNotFoundError exception

2017-08-24 Thread STINNER Victor

STINNER Victor added the comment:

Your change makes test_subprocess f1iling on Windows. Example:
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/891/steps/test/logs/stdio

--

___
Python tracker 

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



[issue22536] subprocess should include filename in FileNotFoundError exception

2017-08-24 Thread Gregory P. Smith

Gregory P. Smith added the comment:

right, the test needs to be excluded there.  fixing... (bummer windows wasn't 
in the CI)

--

___
Python tracker 

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



[issue22536] subprocess should include filename in FileNotFoundError exception

2017-08-24 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
pull_requests: +3241

___
Python tracker 

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



[issue31254] WeakKeyDictionary/Mapping doesn't call __missing__

2017-08-24 Thread Raymond Hettinger

Raymond Hettinger added the comment:

[Anthony Lee]
> The use case is to generate a mapping of weakly-held objects 
> to unique ids, with something like
> 
> id_map = WeakKeyDictionaryWithMissing(lambda *, _counter=itertools.count(): > 
> next(_counter))

Where are you keeping hard references to the keys?  ISTM, you only have a weak 
reference, so the object has no hard references.  Entries in the dictionary are 
discarded when there is no longer a strong reference to the key.

Why did you decide to use a dictionary?  AFAICT, nothing external to the 
dictionary knows about the keys so there is no way to do lookups.

Overall, it doesn't seem like a WeakKeyDictionary with a __missing__() method 
is the right approach for this problem.   It makes me question where it makes 
any sense at all to auto-generate missing keys for a WeakKeyDictionary.

--

___
Python tracker 

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



[issue31254] WeakKeyDictionary/Mapping doesn't call __missing__

2017-08-24 Thread Antony Lee

Antony Lee added the comment:

The original example did not cover the use case and was only there to show the 
current behavior.  The real use case is more something like

obj = (get obj as argument to function, caller has a hard reference to it)
uid = d[obj]

--

___
Python tracker 

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



[issue31254] WeakKeyDictionary/Mapping doesn't call __missing__

2017-08-24 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Just for comparison, what is your best solution without the proposed API 
change?It is helpful to see user code before-and-after to know whether 
there is an improvement that makes the change worth it.

--

___
Python tracker 

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



[issue31274] Support building against homebrew on macOS

2017-08-24 Thread Barry A. Warsaw

New submission from Barry A. Warsaw:

The devguide does touch on how to build Python from source using homebrew 
installed libraries on macOS, although I found it to be 1) a bit incomplete; 2) 
not so easy to discover.

It might make sense to modify configure to autodetect homebrew, or to have a 
switch to enable linking against homebrew libraries.

Barring that, I'd like to at least update the devguide to include details on 
how to also build sqlite3 and zlib modules.

--
assignee: docs@python
components: Build, Documentation
messages: 300819
nosy: barry, docs@python
priority: normal
severity: normal
status: open
title: Support building against homebrew on macOS
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue31274] Support building against homebrew on macOS

2017-08-24 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

If you're proposing changes to the devguide, then please file the issue at 
https://github.com/python/devguide :)

--
nosy: +Mariatta

___
Python tracker 

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



[issue31254] WeakKeyDictionary/Mapping doesn't call __missing__

2017-08-24 Thread Raymond Hettinger

Raymond Hettinger added the comment:

One way to do it:
-

diff --git a/Lib/weakref.py b/Lib/weakref.py
index 1802f32a20..18f26ea8b2 100644
--- a/Lib/weakref.py
+++ b/Lib/weakref.py
@@ -136,6 +136,8 @@ class WeakValueDictionary(collections.abc.MutableMapping):
 self._commit_removals()
 o = self.data[key]()
 if o is None:
+if hasattr(self, '__missing__'):
+return self.__missing__(key)
 raise KeyError(key)
 else:
 return o

Another way to do it:
-

diff --git a/Lib/weakref.py b/Lib/weakref.py
index 1802f32a20..9951b0fb06 100644
--- a/Lib/weakref.py
+++ b/Lib/weakref.py
@@ -131,12 +131,15 @@ class WeakValueDictionary(collections.abc.MutableMapping):
 key = l.pop()
 _remove_dead_weakref(d, key)

+def __missing__(self, key):
+raise KeyError(key)
+
 def __getitem__(self, key):
 if self._pending_removals:
 self._commit_removals()
 o = self.data[key]()
 if o is None:
-raise KeyError(key)
+return self.__missing__(key)
 else:
 return o

--

___
Python tracker 

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



[issue27099] IDLE: turn builting extensions into regular modules

2017-08-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The transferred options belong on the General tab.  I have already planned to 
condense what is there as part of #31051.  I held off because I did not know if 
it would conflict with your patch.  Since, as far as I can tell, your patch 
currently does not touch GenPage, I will change it tomorrow to make room for 
new stuff and think about what layout I would prefer at least for the present.

--

___
Python tracker 

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



[issue30188] test_nntplib: random EOFError in setUpClass()

2017-08-24 Thread Kubilay Kocak

Kubilay Kocak added the comment:

bpo-30188 (and bpo-30188 ?) need merging to 3.6/3.5, 3.6 just failed with:

ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:748)

Full build log attached

--
nosy: +koobs
resolution: fixed -> 
stage: resolved -> backport needed
status: closed -> open
Added file: 
http://bugs.python.org/file47100/koobs-freebsd-current-debug.py36.build.419.log

___
Python tracker 

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



[issue30188] test_nntplib: random EOFError in setUpClass()

2017-08-24 Thread Kubilay Kocak

Kubilay Kocak added the comment:

Apologies I meant 5b4feb7e86 by haypo and 067931dd95d (also needs merge?)  by 
inada.naoki

--

___
Python tracker 

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



[issue14976] queue.Queue() is not reentrant, so signals and GC can cause deadlocks

2017-08-24 Thread Raymond Hettinger

Raymond Hettinger added the comment:

[Antoine Pitrou]
> So perhaps we need C code after all.

This matches my experience with functools.lru_cache() where I used an RLock() 
to handle reentrancy.  That by itself was insufficient.  I also had to make 
otherwise unnecessary variable assignments to hang onto object references to 
avoid a decref triggering arbitrary Python code from reentering before the 
links were all in a consistent state.   Further, I had to create a key wrapper 
to make sure a potentially reentrant __hash__() call wouldn't be made before 
the state was fully updated.  Even then, a potentially reentrant __eq__() call 
couldn't be avoided, so I had to re-order the operations to make sure this was 
the last call after the other state updates.  This defended against all normal 
code, but all these measures still could not defend against signals or a GC 
invocation of __del__, either of which can happen at any time.

On the plus side, we now have a C version of functools.lru_cache() that is 
protected somewhat by the GIL.  On the minus side, it was hard to get right.  
Even with the pure python code as a model, the person who wrote the C code 
didn't fully think through all sources of reentrancy and wrote buggy code that 
shipped in 3.5 and 3.6 (resulting in normal code code triggering 
hard-to-reproduce reentrancy bugs).  The lesson here is that while the C code 
can be written correctly, it isn't easy to do and it is hard to notice when it 
is incorrect.

One other thought:  Given that __del__() can be invoked at almost any time and 
can potentially call any other piece of Python code, we should consider turning 
every lock into an rlock.  Also, there should be some guidance on __del__() 
advising considerable restraint on what gets called.  The world is likely full 
of pure Python code that can't defend itself against arbitrary re-entrancy.

--

___
Python tracker 

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



[issue31254] WeakKeyDictionary/Mapping doesn't call __missing__

2017-08-24 Thread Antony Lee

Antony Lee added the comment:

For my use case, it was easy enough to wrap the `uid = d[obj]` in a try... 
catch... plus locking.

Using setdefault would cause the counter to be incremented every time.  In 
truth, here I did not care about having consecutive uids, so that would have 
worked just as well.

In real truth, it later turned out that I didn't really need numeric uids 
anyways; I could just use weakrefs to the object themselves instead.

--

___
Python tracker 

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



[issue30809] IDLE parenmatch - highlighting options

2017-08-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

As I said on #27099, please do not include new options with the transfer patch.

--

___
Python tracker 

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



[issue31269] bug in islink() and is_symlink()

2017-08-24 Thread Karine

Karine added the comment:

Thanks a lot David

>Четверг, 24 августа 2017, 18:42 +04:00 от "R. David Murray" 
>:
>
>
>R. David Murray added the comment:
>
>I would phrase that as "check if any of the components of the path are links", 
>at which point one "obvious"[*] answer is "any(x.is_symlink() for x in 
>[*mypath.parents, mypath])".  If the path is absolute, you could use "not 
>(mypath.resolve() == mypath)".
>
>[*] I put that in quotes because it is only obvious once you have a 
>non-trivial amount of experience with programming in Python.
>
>--
>
>___
>Python tracker < rep...@bugs.python.org >
>< http://bugs.python.org/issue31269 >
>___

--

___
Python tracker 

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