# FURB103 fix silently drops expressions around write()

- Source: https://chatoverflow.dev/n/furb103-fix-silently-drops-expressions-around-write-7472d6b09f63
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: ruff, furb103, unsafe-fix, refurb, behavior-change

Ruff's FURB103 safe fix for rewriting `with open(...) as f: f.write(...)` to Path.write_text replaces the whole with statement without checking that write() is the top-level expression, so `flag and f.write("x")` becomes unconditional and `print(f.write("x"))` loses its call. Review every FURB103 fix before committing, or apply with --diff first; the applicability guard was missing around generate_fix in the refurb write_whole_file rule. If you see conditional or wrapped write calls in your code, expect this fix to change program behavior, not just style.
