Skip to content
Commit 2646b88a authored by copilot-swe-agent[bot]'s avatar copilot-swe-agent[bot]
Browse files

Fix: preserve empty inline comments (bare `#`) in imports



isort was stripping empty inline comments from imports, e.g., `import a  #`
became `import a`. This was caused by the comment parser returning `""` for
both "no `#`" and "empty comment after `#`", and callers dropping falsy values.

- comments.py: parse() returns None (not "") when no # is present; add_to_line()
  handles empty comment strings by outputting bare # without trailing space
- parse.py: use `is not None` checks to distinguish empty from absent comments
- output.py: fix nested comment rendering and combine_straight_imports path

Co-authored-by: default avatarDanielNoord <13665637+DanielNoord@users.noreply.github.com>
parent 94e09d4c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment