**To Reproduce**
mervy93 opened this issue · comments
To Reproduce
Unformatted code:
def main():
if a:
# Comment
def b():
pass
if b:
def c():
pass
Running black --preview
:
def main():
if a:
# Comment
def b():
pass
if b:
def c():
pass
Expected behavior
Empty line should be consistent added (or removed) between the code block open and inner function:
def main():
if a:
# Comment
def b():
pass
if b:
def c():
pass
Or,
def main():
if a:
# Comment
def b():
pass
if b:
def c():
pass
Additional context
I did a bisect and this was caused by psf/black#3035.
Note that if the inner function doesn't have a leading comment, it won't remove the empty line:
def main():
if a:
def b():
pass
def c():
pass
Thus I believe this is an undesired behavior change in #3035?
Originally posted by @yilei in psf/black#3300