-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_io.TextIOWrapper.write
: write during flush causes pending_bytes
length mismatch
#119506
Labels
type-crash
A hard crash of the interpreter, possibly with a core dump
Comments
chgnrdv
added
the
type-crash
A hard crash of the interpreter, possibly with a core dump
label
May 24, 2024
chgnrdv
added a commit
to chgnrdv/cpython
that referenced
this issue
May 24, 2024
* check if call to `_textiowrapper_writeflush()` has left any data in `self->pending_bytes`. If so, store them in `self->pending_bytes` after `b` * add test
methane
added a commit
that referenced
this issue
Jun 3, 2024
Co-authored-by: Inada Naoki <[email protected]>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Jun 3, 2024
…ythonGH-119507) (cherry picked from commit 52586f9) Co-authored-by: Radislav Chugunov <[email protected]> Co-authored-by: Inada Naoki <[email protected]>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Jun 3, 2024
…ythonGH-119507) (cherry picked from commit 52586f9) Co-authored-by: Radislav Chugunov <[email protected]> Co-authored-by: Inada Naoki <[email protected]>
This was referenced Jun 3, 2024
mliezun
pushed a commit
to mliezun/cpython
that referenced
this issue
Jun 3, 2024
…ython#119507) Co-authored-by: Inada Naoki <[email protected]>
barneygale
pushed a commit
to barneygale/cpython
that referenced
this issue
Jun 5, 2024
…ython#119507) Co-authored-by: Inada Naoki <[email protected]>
kumaraditya303
pushed a commit
that referenced
this issue
Jun 19, 2024
…H-119507) (#119964) gh-119506: fix `_io.TextIOWrapper.write()` write during flush (GH-119507) (cherry picked from commit 52586f9) Co-authored-by: Radislav Chugunov <[email protected]> Co-authored-by: Inada Naoki <[email protected]>
kumaraditya303
pushed a commit
that referenced
this issue
Jun 19, 2024
…H-119507) (#119965) gh-119506: fix `_io.TextIOWrapper.write()` write during flush (GH-119507) (cherry picked from commit 52586f9) Co-authored-by: Radislav Chugunov <[email protected]> Co-authored-by: Inada Naoki <[email protected]>
noahbkim
pushed a commit
to hudson-trading/cpython
that referenced
this issue
Jul 11, 2024
…ython#119507) Co-authored-by: Inada Naoki <[email protected]>
estyxx
pushed a commit
to estyxx/cpython
that referenced
this issue
Jul 17, 2024
…ython#119507) Co-authored-by: Inada Naoki <[email protected]>
hugovk
pushed a commit
that referenced
this issue
Aug 9, 2024
…119507) (#120314) Co-authored-by: Hugo van Kemenade <[email protected]> fix _io.TextIOWrapper.write() write during flush (#119507)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Crash report
What happened?
Bisected to #24592.
Simple repro:
On debug build it causes C assertion failure:
If
_io.TextIOWrapper.write()
tries to store more thanself->chunk_size
data inself->pending_bytes
, it calls_textiowrapper_writeflush()
:cpython/Modules/_io/textio.c
Lines 1726 to 1733 in b48a3db
_textiowrapper_writeflush()
flushesself->pending_bytes
contents to wrapped buffer throughwrite()
method call:cpython/Modules/_io/textio.c
Lines 1621 to 1628 in b48a3db
The problem is that call to
write()
method can cause_io.TextIOWrapper.write()
call (directly, as in repro, or from other thread), which re-setsself->pending_bytes
andself->pending_bytes_count
values.CPython versions tested on:
3.10, 3.11, 3.12, CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.14.0a0 (heads/main:e94dbe4ed8, May 24 2024, 00:47:49) [GCC 10.2.1 20210110]
Linked PRs
_io.TextIOWrapper.write()
write during flush #119507_io.TextIOWrapper.write()
write during flush (GH-119507) #119964_io.TextIOWrapper.write()
write during flush (GH-119507) #119965The text was updated successfully, but these errors were encountered: