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

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

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

B012.py:31:13: B012 `return` inside `finally` blocks cause exceptions to be silenced
   |
31 |             pass
32 |         finally:
33 |             return  # warning
   |             ^^^^^^ B012
34 |     finally:
35 |         pass
   |

B012.py:44:21: B012 `return` inside `finally` blocks cause exceptions to be silenced
   |
44 |                     pass
45 |                 finally:
46 |                     return  # warning
   |                     ^^^^^^ B012
47 | 
48 |         finally:
   |

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

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

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

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

B012.py:107:9: B012 `break` inside `finally` blocks cause exceptions to be silenced
    |
107 |         pass
108 |     finally:
109 |         break  # warning
    |         ^^^^^ B012
    |

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


