Eryk Sun <eryk...@gmail.com> added the comment:

Every time open(r"test.txt", "w") is called, the existing "test.txt" file gets 
overwritten in the filesystem as an empty file. For each iteration, 
setdefault() returns a reference to the first file object, which advances its 
file pointer with each fh.write("\nHello\n") call. For the last write, the file 
pointer is at offset 693 (i.e. 7 * 99), and the OS first writes null bytes up 
to the file pointer. This is normal behavior, not a bug.

----------
nosy: +eryksun

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46193>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to