[New-bugs-announce] [issue33468] Add try-finally contextlib.contextmanager example

Nick Coghlan report at bugs.python.org
Fri May 11 18:31:27 EDT 2018


New submission from Nick Coghlan <ncoghlan at gmail.com>:

The current example for contextlib.contextmanager doesn't use try/finally, which sets folks up for writing resource management context managers that don't clean up after exceptions properly.

There's an example with try/finally down in the contextlib.closing docs, but I'm thinking it would be worthwhile to change the presentation of contextmanager itself.

----------
assignee: ncoghlan
components: Documentation
messages: 316416
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Add try-finally contextlib.contextmanager example
type: enhancement
versions: Python 3.6, Python 3.7, Python 3.8

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


More information about the New-bugs-announce mailing list