[issue34067] Problem with contextlib.nullcontext

Nick Coghlan report at bugs.python.org
Wed Jul 11 11:03:41 EDT 2018


Nick Coghlan <ncoghlan at gmail.com> added the comment:

Right, the merged PR adds a simpler example that handles "ignore exceptions or not" by selecting between suppress() and nullcontext().

The documentation still needs updating to improve or remove the file-based example, and point out that for resources that get acquired on construction, you either need to delay construction to the start of the with statement, or else use ExitStack instead of nullcontext.

----------

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


More information about the Python-bugs-list mailing list