[New-bugs-announce] [issue32145] Wrong ExitStack Callback recipe

Maurizio Zucchelli report at bugs.python.org
Mon Nov 27 03:34:13 EST 2017


New submission from Maurizio Zucchelli <mauzuc90 at yahoo.it>:

The documentation for contextlib.ExitStack (https://docs.python.org/3.7/library/contextlib.html#replacing-any-use-of-try-finally-and-flag-variables) shows an helper class (Callback) to perform cleanup using a callback.
Problem is, Callback.cancel() calls ExitStack.pop_all(), which in turn calls type(self)(), this is not a valid constructor for Callback, since it always expects at least one element.

(I have marked only Python 3.4 and 3.6 since those are the versions where I verified this, but it likely applies to every version.)

----------
assignee: docs at python
components: Documentation
messages: 307037
nosy: Denaun, docs at python
priority: normal
severity: normal
status: open
title: Wrong ExitStack Callback recipe
type: crash
versions: Python 3.4, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32145>
_______________________________________


More information about the New-bugs-announce mailing list