[Python-checkins] [python/cpython] 4d015a: [3.5] bpo-29692: contextlib.contextmanager may inc...

GitHub noreply at github.com
Thu Apr 13 06:14:55 EDT 2017


  Branch: refs/heads/3.5
  Home:   https://github.com/python/cpython
  Commit: 4d015a40a7b9c3c1b8cfbe81453187d700a43163
      https://github.com/python/cpython/commit/4d015a40a7b9c3c1b8cfbe81453187d700a43163
  Author: Mariatta <Mariatta at users.noreply.github.com>
  Date:   2017-04-13 (Thu, 13 Apr 2017)

  Changed paths:
    M Lib/contextlib.py
    M Lib/test/test_contextlib.py
    M Misc/NEWS

  Log Message:
  -----------
  [3.5] bpo-29692: contextlib.contextmanager may incorrectly unchain RuntimeError (GH-949) (#1107)

contextlib._GeneratorContextManager.__exit__ includes a special case to deal with
PEP 479 RuntimeErrors created when `StopIteration` is thrown into the context
manager body.

Previously this check was too permissive, and undid one level of chaining on *all*
RuntimeError instances, not just those that wrapped a StopIteration instance.
(cherry picked from commit 00c75e9a45ff0366c185e9e8a2e23af5a35481b0)




More information about the Python-checkins mailing list