Barry A. Warsaw <ba...@python.org> added the comment: I wasn't even aware that pop_all() tries to create the concrete subtype. I wonder how common subclassing ExitStack is in practice. (Of course, the answer is that we'll never know.)
For 3.7, we should probably delegate instance creation to a new non-private method, e.g. new_stack = self._make_instance() so *if* you subclass, you can create the new ExitStack subclass instances any way you want. I would then change the default implementation to make an ExitStack() explicitly, as per the current documentation. +1 for fixing the recipe and not changing the code for 3.6. You might want to add a note describing the current behavior for <= 3.6 and indicating that this will change for 3.7+ Finally, while you're at it, is there any reason not to change the recipe to use: super().__init__() instead? ---------- _______________________________________ 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