summaryrefslogtreecommitdiffstats
path: root/Python/getcopyright.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2018-01-02 17:25:41 (GMT)
committerGitHub <noreply@github.com>2018-01-02 17:25:41 (GMT)
commitdbf52e02f18dac6f5f0a64f78932f3dc6efc056b (patch)
treed506cffda230dde7ccb2bf9c2ba4e40f749b18c3 /Python/getcopyright.c
parent0e0d1017a4c8ad6f77ee42d7b640463058037f62 (diff)
downloadcpython-dbf52e02f18dac6f5f0a64f78932f3dc6efc056b.zip
cpython-dbf52e02f18dac6f5f0a64f78932f3dc6efc056b.tar.gz
cpython-dbf52e02f18dac6f5f0a64f78932f3dc6efc056b.tar.bz2
bpo-31530: fix crash when multiple threads iterate over a file, round 2 (#5060)
Multiple threads iterating over a file can corrupt the file's internal readahead buffer resulting in crashes. To fix this, cache buffer state thread-locally for the duration of a file_iternext call and only update the file's internal state after reading completes. No attempt is made to define or provide "reasonable" semantics for iterating over a file on multiple threads. (Non-crashing) races are still present. Duplicated, corrupt, and missing data will happen. This was originally fixed by 6401e5671781eb217ee1afb4603cc0d1b0367ae6, which raised an exception from seek() and next() when concurrent operations were detected. Alas, this simpler solution breaks legitimate use cases such as capturing the standard streams when multiple threads are logging.
Diffstat (limited to 'Python/getcopyright.c')
0 files changed, 0 insertions, 0 deletions