You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Calling isort with --sort-reexports with input from stdin fails #2393
The fix adds a seekability check in api.sort_stream() before calling core.process() , if sort_reexports is enabled and the output stream is not seekable, it swaps in an internal StringIO buffer, following the same pattern already used for non-readable streams in the atomic code path.
hey there!
thanks for the feedback, updated per your feedback, instead of silently buffering, the fix now raises a clear ValueError when --sort reexports is used with a non-seekable stream. Also fixed the E302 and W292 lint issues.
i apologize but i didn't mean to waste anyone's time, was trying to make some helpful contribution that's all, anyways hopefully this update fits the bill here, the check is now at the CLI level in main.py, raising a clear error when --sort-reexports is used with stdin ('-'), following the same pattern as the existing show_files check. The api.py change has been reverted.
Activity
Fix PyCQA#2393: --sort-reexports fails with non-seekable streams like…
DanielNoord commentedon Mar 12, 2026
#2399 attempts to fix this, but I'm wondering if we should just make this an error.
The code of
sort-reexportssimply does not work well with non-seekable streams. It seems simpler to just disallow this?Abdu-Ahmed commentedon May 24, 2026
Hiya folks!
i've opened a PR that fixes this: #2547
The fix adds a seekability check in
api.sort_stream()before callingcore.process(), ifsort_reexportsis enabled and the output stream is not seekable, it swaps in an internalStringIObuffer, following the same pattern already used for non-readable streams in the atomic code path.DanielNoord commentedon May 26, 2026
@Abdu-Ahmed Did you see my comment above? Unfortunately on your branch CI fails as well.
Raise ValueError when sort_reexports used with non-seekable stream
Abdu-Ahmed commentedon May 28, 2026
hey there!
thanks for the feedback, updated per your feedback, instead of silently buffering, the fix now raises a clear ValueError when --sort reexports is used with a non-seekable stream. Also fixed the E302 and W292 lint issues.
DanielNoord commentedon May 28, 2026
Please read the full issue. You are wasting other people's time...
Raise error when --sort-reexports is used with stdin
Abdu-Ahmed commentedon Jun 1, 2026
hey there daniel!
i apologize but i didn't mean to waste anyone's time, was trying to make some helpful contribution that's all, anyways hopefully this update fits the bill here, the check is now at the CLI level in main.py, raising a clear error when --sort-reexports is used with stdin ('-'), following the same pattern as the existing show_files check. The api.py change has been reverted.
Fix --sort-reexports crash with non-seekable streams (e.g. stdin)
Raise ValueError when sort_reexports used with non-seekable stream
Raise error when --sort-reexports is used with stdin