---
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs
---
B012 `return` inside `finally` blocks cause exceptions to be silenced
 --> B012.py:5:9
  |
3 |         pass
4 |     finally:
5 |         return  # warning
  |         ^^^^^^
  |

B012 `return` inside `finally` blocks cause exceptions to be silenced
  --> B012.py:13:13
   |
11 |     finally:
12 |         if 1 + 0 == 2 - 1:
13 |             return  # warning
   |             ^^^^^^
   |

B012 `return` inside `finally` blocks cause exceptions to be silenced
  --> B012.py:21:13
   |
19 |     finally:
20 |         try:
21 |             return  # warning
   |             ^^^^^^
22 |         except Exception:
23 |             pass
   |

B012 `return` inside `finally` blocks cause exceptions to be silenced
  --> B012.py:31:13
   |
29 |             pass
30 |         finally:
31 |             return  # warning
   |             ^^^^^^
32 |     finally:
33 |         pass
   |

B012 `return` inside `finally` blocks cause exceptions to be silenced
  --> B012.py:44:21
   |
42 |                     pass
43 |                 finally:
44 |                     return  # warning
   |                     ^^^^^^
45 |
46 |         finally:
   |

B012 `break` inside `finally` blocks cause exceptions to be silenced
  --> B012.py:66:13
   |
64 |             pass
65 |         finally:
66 |             break  # warning
   |             ^^^^^
67 |
68 |             def j():
   |

B012 `continue` inside `finally` blocks cause exceptions to be silenced
  --> B012.py:78:13
   |
76 |             pass
77 |         finally:
78 |             continue  # warning
   |             ^^^^^^^^
79 |
80 |             def j():
   |

B012 `return` inside `finally` blocks cause exceptions to be silenced
  --> B012.py:94:13
   |
92 |             continue  # no warning
93 |         while True:
94 |             return  # warning
   |             ^^^^^^
   |

B012 `continue` inside `finally` blocks cause exceptions to be silenced
   --> B012.py:101:9
    |
 99 |         pass
100 |     finally:
101 |         continue  # warning
    |         ^^^^^^^^
102 |
103 | while True:
    |

B012 `break` inside `finally` blocks cause exceptions to be silenced
   --> B012.py:107:9
    |
105 |         pass
106 |     finally:
107 |         break  # warning
    |         ^^^^^
    |

B012 `break` inside `finally` blocks cause exceptions to be silenced
   --> B012.py:118:17
    |
116 |                 y = 0
117 |             case 0, *x:
118 |                 break  # warning
    |                 ^^^^^
    |
