cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Adding read/readline() after write appends to EOF, not to the position

Open dom-0 opened this issue 1 year ago • 0 comments

Bug report

Bug description:

with open("testfile", "r+") as my_file:

    text = my_file.write("========")
    print(my_file.readline())

Instead of writing to the beginning of the file, the program writes to the EOF even if readline() is placed after write.

CPython versions tested on:

3.8, 3.9

Operating systems tested on:

Windows

dom-0 avatar Mar 20 '24 19:03 dom-0