Nick Coghlan <ncogh...@gmail.com> added the comment:

Hmm, I think that may actually qualify as a bug in the `pop_all()` 
implementation: 
https://docs.python.org/3/library/contextlib.html#contextlib.ExitStack.pop_all 
states that it returns an ExitStack instance, not an instance of the current 
type.

For 3.6 (and hence the online docs), we can fix the recipe to allow for 
`callback=None` (with the expectation that the callback will be added 
afterwards).

Barry, I'd be interested in your thoughts on what to do for 3.7+ - we can 
either leave the current behaviour alone, and amend the documentation, or else 
change the code to call ExitStack directly, rather than type(self).

I'm leaning towards only changing the docs as being lower risk - folks may be 
relying on the current behaviour, so changing it may break their code, whereas 
changing the docs doesn't risk breaking anything.

----------
nosy: +barry
versions: +Python 3.7 -Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32145>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to