diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-12-20 21:18:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-20 21:18:08 (GMT) |
commit | 409ce4a09e4f96ca9b251c19f5819205aae9ae34 (patch) | |
tree | 692462c290f45309d75d2b2f6523a1e9951ef0fc /Tools/gdb/libpython.py | |
parent | 40b4c405f98f2d35835ef5d183f0327c0c55da6f (diff) | |
download | cpython-409ce4a09e4f96ca9b251c19f5819205aae9ae34.zip cpython-409ce4a09e4f96ca9b251c19f5819205aae9ae34.tar.gz cpython-409ce4a09e4f96ca9b251c19f5819205aae9ae34.tar.bz2 |
bpo-42669: Document that `except` rejects nested tuples (GH-23822) (GH-23870)
In Python 2, it was possible to use `except` with a nested tuple, and occasionally natural. For example, `zope.formlib.interfaces.InputErrors` is a tuple of several exception classes, and one might reasonably think to do something like this:
try:
self.getInputValue()
return True
except (InputErrors, SomethingElse):
return False
As of Python 3.0, this raises `TypeError: catching classes that do not inherit from BaseException is not allowed` instead: one must instead either break it up into multiple `except` clauses or flatten the tuple. However, the reference documentation was never updated to match this new restriction. Make it clear that the definition is no longer recursive.
Automerge-Triggered-By: GH:ericvsmith
(cherry picked from commit c95f8bc2700b42f4568886505a819816c9b0ba28)
Co-authored-by: Colin Watson <cjwatson@debian.org>
Co-authored-by: Colin Watson <cjwatson@debian.org>
Diffstat (limited to 'Tools/gdb/libpython.py')
0 files changed, 0 insertions, 0 deletions