New submission from Keepun <kee...@gmail.com>:

"""
Using a dictionary for open files.

The file is filled with NULL. Only the last entry is normal.

Result:
00 00 00 00 ... 00 0A 48 65 6C 6C 6F 0A

Ubuntu - 3.8.10
Windows - 3.9.8
"""
fhandles = {}
for f in range(100):
    fh = fhandles.setdefault("suffix", open(r"test.txt", "w"))
    fh.write("\nHello\n")
    fh.flush()
for f in fhandles.values():
    f.close()

import sys
print(sys.version_info)

----------
components: IO
messages: 409303
nosy: Keepun
priority: normal
severity: normal
status: open
title: Using a dictionary for open files.
type: behavior
versions: Python 3.8, Python 3.9

_______________________________________
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