[issue43028] seeking past the end of a file unexpected behavior

2021-01-25 Thread Cotton Seed
Cotton Seed added the comment: Christian, thanks for the quick response and the clarification. I understand my mistake now. Thanks! -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue43028] seeking past the end of a file unexpected behavior

2021-01-25 Thread Christian Heimes
Christian Heimes added the comment: The high level and low level variants behave the same if you pass in the same flags. You are using the append flag in "open()", but you don't pass the os.O_APPEND flag to "os.open()". >>> import os >>> fd = os.open('log', os.O_WRONLY | os.O_APPEND | os.O_C

[issue43028] seeking past the end of a file unexpected behavior

2021-01-25 Thread Cotton Seed
New submission from Cotton Seed : Seeking past the end of a file with file objects does not match the same code implemented in terms of file descriptors. Is this the intended behavior? Smallest example I could find: f = open('new_file', 'ab') print(f.seek(1)) print(f.write(b'foo')) print(f.t