[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 the necessary 
information to do this, since it doesn't know what kind of method it's dealing 
with (it has no idea what decorators actually do, it just compiles them as 
subexpressions). Instead, the compiler blindly translates "super()" into 
"super(__class__, )" when inside a function 
definition that's inside a class definition. As a result, there's no way for 
the compiler to special case static methods and pass __class__ as the second 
argument as well.

Even without considering that technical limitation though, using __class__ for 
both arguments doesn't do anything particularly sensible, since super() is 
specifically about resolving name lookups using the *dynamic* method resolution 
order (MRO) of the class the method was retrieved from (which may be a subclass 
of the class defining the method).

So in instance methods and class methods, type(self) or cls provides the 
dynamic MRO to use, while __class__ identifies *where* along that MRO the 
currently running method implementation sits.

In a static method, there's no dynamic MRO available for super() to query. This 
means that if you want access to one, you need to convert the method to a 
classmethod first so that the interpreter will pass in a reference to the class 
the method was retrieved from (as opposed to the one where it was defined, 
which is what __class__ gives you).

If folks actually do want to make a method implementation in a child class 
depend on a static method in a parent class, there are two ways to do that, but 
only one of them will work correctly in the face of multiple inheritance:

1. Make the child method a class method. This is the most readable approach, 
since you can then use zero-argument super() to call the staticmethod in the 
parent class in the usual way. As long as all child classes overriding the 
method adhere to this approach, that particular class hierarchy will also 
reliably respect Python's MRO linearisation rules in the case of multiple 
inheritance.

2. Make the child method a staticmethod, and then use "super(__class__, 
__class__)" to access the staticmethod in the parent class. This will work OK 
in cases where there aren't any diamonds in the inheritance hierarchy, but it 
completely bypasses the dynamic C3 linearisation algorithm, and hence may do 
weird things in the presence of such diamonds (i.e. cases where a subclass has 
multiple inheritance paths back to a given base class - see 
https://python-history.blogspot.com.au/2010/06/method-resolution-order.html for 
more detail on this).

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



[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 (implicit laziness) would break cases where 
callables and types are used as first class values.

Add keyword argument: lazy?  Thus mydict.setdefault('eggs',list, lazy=True) 
would generate a new list only when necessary while the default would still be 
to append a reference to list (first class) objects).

--
messages: 300596
nosy: jimd
priority: normal
severity: normal
status: open
title: Add lazy evaluation support for dict.setdefault()
type: enhancement

___
Python tracker 

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



[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: 
https://wrapt.readthedocs.io/en/latest/wrappers.html#object-proxy

I actually think we *should* do that, and occasionally bug Graham Dumpleton 
about it, but while he's not opposed to the idea, it's also something that 
would take quite a bit of work (since odd edge cases that are tolerable in an 
opt-in third party module would probably need to be addressed for a standard 
library version).

For test cases like AsyncExitStack though, we instead just use custom type 
definitions, rather than the unittest.mock module.

Autospec'ed mocks are most attractive when we're dealing with object interfaces 
that are subject to a high rate of churn (since they make the tests more 
self-adjusting), and that isn't the case here: Python's syntactic support 
protocols rarely change, and when they do, preserving backwards compatibility 
with existing classes is typically a key requirement.

--

___
Python tracker 

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



[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 

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



[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 contains:
hosts:   files mymachines resolve [!UNAVAIL=return] dns myhostname

--

___
Python tracker 

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



[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 mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 if a simple delete can be handled.

--

___
Python tracker 

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



[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


--

___
Python tracker 

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



[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 platform-dependent limitation - it's an OverflowError. 
Before that PR, the _length_ maximum value was hard-coded in the method itself, 
thus one might say that it was "a part of logic". With this PR, you just need a 
system with a large enough size_t. 
(May be, after a thousand years, it would even handle 2**1000. But negative 
values would be still logically incorrect. Thus, I'm only talking about "too 
large" case.)

2) It would be much more difficult to run into this limitation in a daily 
practice (e.g. by passing a very long string).

--

___
Python tracker 

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



[issue31109] zipimport argument clinic conversion

2017-08-19 Thread Brett Cannon

Changes by Brett Cannon :


--
resolution:  -> fixed
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



[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 this tracker. If you find nothing then feel free to open an issue and 
add Michael Foord to nosy list.

--

___
Python tracker 

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



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

--

___
Python tracker 

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



[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 that reads gi_yieldfrom, and the only code 
> that reads cr_await is a Python 3.5 compatibility hack in asyncio.

I'm -1 on this too.  gi_yieldfrom and cr_await are very special and rarely used 
things.  Refactoring or unifying them isn't trivial and ultimately not as 
useful.

--

___
Python tracker 

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



[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 on the class is how it should be done as that's 
how the rest of Python works.  And that's how ExitStack is currently 
implemented for synchronous "with" blocks.  We won't be able to change this 
behaviour even if we wanted to, so it stays.

Here's an example:

class Foo:
def __init__(self):
self.__aenter__ = ...
self.__aexit__ = ...

If we implement AsyncExitStack to lookup __anter__ directly on the object, then 
the above Foo class would be supported by it, but at the same time rejected by 
the 'async with' statement.

> Yury, I could take a second look and try to change this into a patch if 
> that's OK.

By all means you can submit a PR!

--

___
Python tracker 

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



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

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



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

2017-08-19 Thread Stefan Krah

Changes by Stefan Krah :


--
pull_requests: +3194

___
Python tracker 

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



[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 

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



[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)
https://github.com/python/cpython/commit/764e282158df0d7d6d7e0c72f38756c979a36539


--

___
Python tracker 

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



[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)
https://github.com/python/cpython/commit/764e282158df0d7d6d7e0c72f38756c979a36539


--

___
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-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 
> locked raises RuntimeError instead of deadlocking the way it does now?

No.  It's not a deadlock, since you can release a Lock from another thread.

--

___
Python tracker 

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



[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 module's state 
introspection support to also cover async generators, while also allowing for 
the soft (i.e. documentation only) deprecation of the generator and coroutine 
specific variants of those APIs.

Issue 31183 already showed the potential value of a __code__ attribute, since 
it would allow all of the asynchronous operations to be handled by the same 
code path that already handles functions.

I'm less sure about __delegated_to__/__returns_to__, since we don't have *any* 
code in the standard library that reads gi_yieldfrom, and the only code that 
reads cr_await is a Python 3.5 compatibility hack in asyncio.

--

___
Python tracker 

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



[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 for async operations).

--

___
Python tracker 

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



[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 

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



[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 

___
___
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-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 now?

Then they could sensibly expose the same "_is_locked()" API as RLock, while 
still disallowing reentrancy by default.

--

___
Python tracker 

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



[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: http://www.unicode.org/reports/tr15/tr15-24.html#hangul_composition

After Unicode 4.1.0, here is TBase < code < TBase+TCount, which in line with 
the latest version (Unicode 10.0)
see: http://www.unicode.org/reports/tr15/tr15-25.html#hangul_composition

This change happened in 2005.

--

___
Python tracker 

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



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

2017-08-19 Thread Cheryl Sabella

Changes by Cheryl Sabella :


--
pull_requests: +3193

___
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-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 any of the threading/locking libraries 
> we still support (I presume that's basically posix and Windows).

Regular Locks don't have the notion of an owning thread so, while we
could add it, that would be a bizarre API.

We can also detect reentrancy in get() and raise an error.

--

___
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-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 the queue is full 
> and the lock is already taken, right? 

Currently it gives a decent message on any bounded queue, even if not
full.  That may be improved, I'd have to investigate how.

--

___
Python tracker 

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



[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 1, in 
OverflowError: Python int too large to convert to C ssize_t

and also:
class T(ctypes.Array):
_type_ = ctypes.c_int
_length_ = -1
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: array too large

--

___
Python tracker 

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



[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 try to change this into a patch if that's 
OK.

--
nosy: +Ilya.Kulakov

___
Python tracker 

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



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

Even if this were not so, it is not something that could be changed, for 
backward compatibility reasons.  

If you want a different data types, make them :)

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



[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 

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



[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


--

___
Python tracker 

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



[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


--

___
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-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 reproduced with 
sys.settrace:

```
>>> import sys
>>> import queue
>>> the_queue=queue.Queue()
>>> counter = 0
>>> def bad_trace(*args):
... global counter
... counter += 1
... print(counter)
... the_queue.put(counter)
... return bad_trace
... 
>>> sys.settrace(bad_trace)
>>> the_queue.put(None)
1
2
3
4
5
6
7
[and here we have a deadlock]
```

--

___
Python tracker 

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



[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 

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



[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 

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



[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 last):
  File "", line 1, in 
TypeError: unsupported operand type(s) for >>: 'builtin_function_or_method' and 
'int'. Did you mean "print(, file=)"
```

Anyway, I'll put together a PR that combines both the original patch and the 
follow up fix to add the missing question mark.

--

___
Python tracker 

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