Bug report
Bug description:
Here is a section of what I am doing mid-script:
from time import sleep
print(f"\x1b[1K\rPart", end="")
# Conditions for printing, removed for the sake of simplifying
print(" - Appendix", end="", flush=True)
sleep(1) # Other processing occurs
# Resetting line before other outputs
print("\x1b[1K\r", end="")
This works fine:
print(f"\x1b[1K\rPart", end="")
print(" - Appendix", end="")
This does not:
from time import sleep
print(f"\x1b[1K\rPart", end="")
print(" - Appendix", end="")
sleep(1)
Somehow, the - Appendix print is not flushed before the end of script (after sleep here)
Forced with:
from time import sleep
print(f"\x1b[1K\rPart", end="")
print(" - Appendix", end="", flush=True)
sleep(1)
Since the flush organically happens at the end of the script, any non-flushed print after one having leveraged the 1K ANSI code & carriage return sequence will never be displayed before the line erasure at the end of the section.
This seems like some buggy line flush detection, forcing it on standard file descriptors (here stdout) feeling unreasonable.
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Bug report
Bug description:
Here is a section of what I am doing mid-script:
This works fine:
This does not:
Somehow, the
- Appendixprint is not flushed before the end of script (aftersleephere)Forced with:
Since the flush organically happens at the end of the script, any non-flushed
printafter one having leveraged the1KANSI code & carriage return sequence will never be displayed before the line erasure at the end of the section.This seems like some buggy line flush detection, forcing it on standard file descriptors (here
stdout) feeling unreasonable.CPython versions tested on:
3.13
Operating systems tested on:
Linux