[issue31118] Make super() work with staticmethod by using __class__ for both arguments to super()

2017-08-19 Thread Nick Coghlan
Nick Coghlan added the comment: Thanks for the suggestion, but I'm closing this RFE, as there are two strong arguments against it: one related to implementation feasibility, and one related to the nature of what super() *does*. The feasibility argument is that the compiler doesn't even have

[issue31240] Add lazy evaluation support for dict.setdefault()

2017-08-19 Thread Jim Dennis
New submission from Jim Dennis: Code such as mydict.setdefault('eggs', []) will needlessly incur the cost of instantiating a list even when 'eggs' is already a valid key in mydict. collections.defaultdict will not do this. detecting and automatically calling "callable" and "type" objects

[issue29302] add contextlib.AsyncExitStack

2017-08-19 Thread Nick Coghlan
Nick Coghlan added the comment: While it *may* be possible to do something simpler for test purposes where performance isn't a major concern, fully supporting type() level mocking basically requires bringing the equivalent of wrapt object proxies into the standard library:

[issue31118] Make super() work with staticmethod by using __class__ for both arguments to super()

2017-08-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: Do you have a use case? This seems doesn't seem like it would be helpful at all and would make super a little more confusing than it already is. -- nosy: +rhettinger ___ Python tracker

[issue5004] socket.getfqdn() doesn't cope properly with purely DNS-based setups

2017-08-19 Thread devurandom
devurandom added the comment: In my case, /etc/hostname, /proc/sys/kernel/hostname, `uname -n`, `hostname -f` all show the same FQDN, but `python -c 'import socket ; print(socket.getfqdn())'` still prints the short hostname. /etc/hosts is empty except for localhost. /etc/nsswitch.conf

[issue5004] socket.getfqdn() doesn't cope properly with purely DNS-based setups

2017-08-19 Thread devurandom
Changes by devurandom : -- nosy: +devurandom ___ Python tracker ___ ___ Python-bugs-list

[issue31206] IDLE, configdialog: Factor out HighPage class from ConfigDialog

2017-08-19 Thread Terry J. Reedy
Terry J. Reedy added the comment: Ditto last message for PR3156 and 3rd patch deleting old code now dead. In retrospect, we could have done first and second patches together. Deleting or commenting out a large existing block along with other changes triggers the nonsense diff. Let's see

[issue31206] IDLE, configdialog: Factor out HighPage class from ConfigDialog

2017-08-19 Thread Terry J. Reedy
Terry J. Reedy added the comment: New changeset 8f7a798edbdbca9a400105e3225463e59b334666 by Terry Jan Reedy (Cheryl Sabella) in branch 'master': bpo-31206: IDLE: Factor HighPage class from ConfigDialog (#3156) https://github.com/python/cpython/commit/8f7a798edbdbca9a400105e3225463e59b334666

[issue29843] errors raised by ctypes.Array for invalid _length_ attribute

2017-08-19 Thread Igor
Igor added the comment: Oren, 1) I might be completely wrong, but, personally, I think about OverflowError vs ValueError difference like this: if the value couldn't be handled because method's logic cannot handle it - it's a ValueError; if it could not be handled because of a low-level

[issue31109] zipimport argument clinic conversion

2017-08-19 Thread Brett Cannon
Changes by Brett Cannon : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___

[issue29302] add contextlib.AsyncExitStack

2017-08-19 Thread Yury Selivanov
Yury Selivanov added the comment: >> but at the same time rejected by the 'async with' statement. > Perhaps unittest.mock (or type) needs to be adjusted to allow mocking via > spec= without subclassing? Maybe. You should try to find discussions around this topic on python mailing lists and

[issue29302] add contextlib.AsyncExitStack

2017-08-19 Thread Ilya Kulakov
Ilya Kulakov added the comment: > but at the same time rejected by the 'async with' statement. Perhaps unittest.mock (or type) needs to be adjusted to allow mocking via spec= without subclassing? > By all means you can submit a PR! I'll take a look then. --

[issue31230] Define a general "asynchronous operation introspection" protocol

2017-08-19 Thread Yury Selivanov
Yury Selivanov added the comment: > I started a local PR at https://github.com/ncoghlan/cpython/pull/1/files to > explore what this might look like in practice. Looks good to me. > I'm less sure about __delegated_to__/__returns_to__, since we don't have > *any* code in the standard library

[issue29302] add contextlib.AsyncExitStack

2017-08-19 Thread Yury Selivanov
Yury Selivanov added the comment: > I'm not sure about type() to get a class object and calling __aenter__, > __aexit__ through it: that makes it hard to mock these classes as Mock's > spec= relies on __class__ and type() seem to ignore it (learned it a hard way. Looking up __dunder__ methods

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-19 Thread Stefan Krah
Stefan Krah added the comment: PR 3157 addresses everything apart from expat and https://github.com/python/cpython/blob/master/Modules/cjkcodecs/_codecs_iso2022.c#L816 I'm not sure about that one. It looks harmless but a bit odd. -- ___ Python

[issue30923] Add -Wimplicit-fallthrough=0 to Makefile ?

2017-08-19 Thread Stefan Krah
Changes by Stefan Krah : -- pull_requests: +3194 ___ Python tracker ___ ___

[issue5001] Remove assertion-based checking in multiprocessing

2017-08-19 Thread drallensmith
drallensmith added the comment: I've updated the PR to include all of the non-Windows-specific asserts; I am not sufficiently familiar with Windows multiprocessing to feel confident writing informative error messages. -- ___ Python tracker

[issue31205] IDLE, configdialog: Factor out KeysPage class from ConfigDialog

2017-08-19 Thread Terry J. Reedy
Terry J. Reedy added the comment: New changeset 764e282158df0d7d6d7e0c72f38756c979a36539 by Terry Jan Reedy (Cheryl Sabella) in branch '3.6': [3.6] bpo-31206: IDLE: Factor HighPage class from ConfigDialog (GH-3141) (#3154)

[issue31206] IDLE, configdialog: Factor out HighPage class from ConfigDialog

2017-08-19 Thread Terry J. Reedy
Terry J. Reedy added the comment: New changeset 764e282158df0d7d6d7e0c72f38756c979a36539 by Terry Jan Reedy (Cheryl Sabella) in branch '3.6': [3.6] bpo-31206: IDLE: Factor HighPage class from ConfigDialog (GH-3141) (#3154)

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

2017-08-19 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 19/08/2017 à 12:09, Nick Coghlan a écrit : > > Would it be feasible to change the behaviour of non-reentrant locks such that: > > 1. They *do* keep track of the owning thread Yes. > 2. Trying to acquire them again when the current thread already has them

[issue31230] Define a general "asynchronous operation introspection" protocol

2017-08-19 Thread Nick Coghlan
Nick Coghlan added the comment: I started a local PR at https://github.com/ncoghlan/cpython/pull/1/files to explore what this might look like in practice. I think that what I've done so far shows that generic __frame__ and __running__ attributes would be sufficient to extend the inspect

[issue31183] `Dis` module doesn't know how to disassemble async generator or coroutine objects

2017-08-19 Thread Nick Coghlan
Nick Coghlan added the comment: Thanks for the patch! Issue 31230 is a follow-up issue looking at whether or not we should define a general "__code__" attribute as a general purpose introspection protocol for disassembly support (amongst other generalisations of state introspection support

[issue31183] `Dis` module doesn't know how to disassemble async generator or coroutine objects

2017-08-19 Thread Nick Coghlan
Changes by Nick Coghlan : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue31120] [2.7] Python 64 bit _ssl compile fails due missing buildinf_amd64.h

2017-08-19 Thread Hiren Vadalia
Hiren Vadalia added the comment: Hey Zach, Any update on this? -- ___ Python tracker ___ ___

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

2017-08-19 Thread Nick Coghlan
Nick Coghlan added the comment: Would it be feasible to change the behaviour of non-reentrant locks such that: 1. They *do* keep track of the owning thread 2. Trying to acquire them again when the current thread already has them locked raises RuntimeError instead of deadlocking the way it does

[issue29456] bugs in unicodedata.normalize: u1176, u11a7 and u11c3

2017-08-19 Thread Wonsup Yoon
Wonsup Yoon added the comment: This patch fixes changes in Unicode 4.1.0. I think it well reviewed and it is time to merge. Who can commit this patch? @animalize says: Let me give a supplement: Before Unicode 4.1.0 (draft), here is: TBase <= code <= TBase+TCount see:

[issue31206] IDLE, configdialog: Factor out HighPage class from ConfigDialog

2017-08-19 Thread Cheryl Sabella
Changes by Cheryl Sabella : -- pull_requests: +3193 ___ Python tracker ___ ___

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

2017-08-19 Thread Antoine Pitrou
Antoine Pitrou added the comment: Oh and: Le 18/08/2017 à 23:26, Guido van Rossum a écrit : > > I can't say I understand all of Antoine's patch, but it's probably okay to do > it this way; however I would rather see if we can add _is_owned() to Lock, > assuming it can be implemented using

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

2017-08-19 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 18/08/2017 à 23:26, Guido van Rossum a écrit : > > IIUC the end result would be a Queue whose put() works from signal handlers, > GC callbacks and __del__, as long as it's unbounded, right? Yes. > And when it *is* bounded, it will give a decent message if

[issue29843] errors raised by ctypes.Array for invalid _length_ attribute

2017-08-19 Thread Oren Milman
Oren Milman added the comment: I am not sure I understood your question, Igor. I compiled with https://github.com/python/cpython/pull/3006, and got: class T(ctypes.Array): _type_ = ctypes.c_int _length_ = 2 ** 1000 Traceback (most recent call last): File "", line

[issue29302] add contextlib.AsyncExitStack

2017-08-19 Thread Ilya Kulakov
Ilya Kulakov added the comment: I'm not sure about type() to get a class object and calling __aenter__, __aexit__ through it: that makes it hard to mock these classes as Mock's spec= relies on __class__ and type() seem to ignore it (learned it a hard way. Yury, I could take a second look and

[issue31239] namedtuple comparison ignores types

2017-08-19 Thread R. David Murray
R. David Murray added the comment: This is by design: namedtuples are tuples in which you can access the elements by name. If you have a tuple with the same elements, but no name access, they should compare equal, because they are fundamentally tuples. The names are just a convenience.

[issue31232] Backport the new custom "print >> sys.stderr" error message?

2017-08-19 Thread Nick Coghlan
Nick Coghlan added the comment: Thanks all! -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___

[issue30721] Show expected input for right shift operator usage in custom "print" error message

2017-08-19 Thread Nick Coghlan
Nick Coghlan added the comment: New changeset 1a05e87ec75436d818f05a5dabcecaea67334cbd by Nick Coghlan in branch '3.6': [3.6] bpo-31232: Backport custom print rshift message (GH-3155) https://github.com/python/cpython/commit/1a05e87ec75436d818f05a5dabcecaea67334cbd --

[issue31232] Backport the new custom "print >> sys.stderr" error message?

2017-08-19 Thread Nick Coghlan
Nick Coghlan added the comment: New changeset 1a05e87ec75436d818f05a5dabcecaea67334cbd by Nick Coghlan in branch '3.6': [3.6] bpo-31232: Backport custom print rshift message (GH-3155) https://github.com/python/cpython/commit/1a05e87ec75436d818f05a5dabcecaea67334cbd --

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

2017-08-19 Thread Nick Coghlan
Nick Coghlan added the comment: +1 for treating Queue.put() specifically as the case to be handled, as that's the mechanism that can be used to *avoid* running complex operations directly in __del__ methods and weakref callbacks. For testing purposes, the current deadlock can be reliably

[issue30721] Show expected input for right shift operator usage in custom "print" error message

2017-08-19 Thread Nick Coghlan
Changes by Nick Coghlan : -- pull_requests: +3192 ___ Python tracker ___ ___

[issue31232] Backport the new custom "print >> sys.stderr" error message?

2017-08-19 Thread Nick Coghlan
Changes by Nick Coghlan : -- pull_requests: +3191 ___ Python tracker ___ ___

[issue31232] Backport the new custom "print >> sys.stderr" error message?

2017-08-19 Thread Nick Coghlan
Nick Coghlan added the comment: The condition we (mostly Serhiy) came up with for the check is actually kinda neat, since it's based on the value of the LHS and is hard to trigger accidentally: ``` >>> printf = print >>> print = 10 >>> print >> 1 5 >>> printf >> 1 Traceback (most recent call