You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TextFileWrapper can read more characters than what was requested. While this doesn't sound like an issue from Python it poses a problem for C, where the result of e.g. await afp.read(8192) will be re-written to a static Py_UCS4 buffer[8192]. This has caused MKuranowski/aiocsv#24.
Expected behavior
TextFileWrapper.read should never return more characters than what was requested. This is an explicit requirement for synchronous reads: "Read and return at mostsize characters from the stream [...]"
Actual behavior
TextFileWrapper can read more characters.
Steps to reproduce
Example text file, unhdr_jpn.txt, UTF-8. Any variable-width encoding triggers this issue, provided that read chunks fall in the middle of a character.
Long story short
TextFileWrapper can read more characters than what was requested. While this doesn't sound like an issue from Python it poses a problem for C, where the result of e.g.
await afp.read(8192)
will be re-written to a staticPy_UCS4 buffer[8192]
. This has caused MKuranowski/aiocsv#24.Expected behavior
TextFileWrapper.read should never return more characters than what was requested. This is an explicit requirement for synchronous reads: "Read and return at most size characters from the stream [...]"
Actual behavior
TextFileWrapper can read more characters.
Steps to reproduce
Example text file,
unhdr_jpn.txt
, UTF-8. Any variable-width encoding triggers this issue, provided that read chunks fall in the middle of a character.Code:
Environment info
Kernel version:
Linux sedna 6.7.2-arch1-1-surface #1 SMP PREEMPT_DYNAMIC Mon, 29 Jan 2024 23:19:41 +0000 x86_64 GNU/Linux
File system:
btrfs
I have been produced this problem with implementations:
Additional info
None :)
The text was updated successfully, but these errors were encountered: