This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Keepun
Recipients Keepun
Date 2021-12-29.12:34:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1640781299.57.0.336049681987.issue46193@roundup.psfhosted.org>
In-reply-to
Content
"""
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)
History
Date User Action Args
2021-12-29 12:34:59Keepunsetrecipients: + Keepun
2021-12-29 12:34:59Keepunsetmessageid: <1640781299.57.0.336049681987.issue46193@roundup.psfhosted.org>
2021-12-29 12:34:59Keepunlinkissue46193 messages
2021-12-29 12:34:59Keepuncreate