GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — `_io.TextIOWrapper.write`: write during flush causes `pending_bytes` length mismatch · Issue #119506 · python/cpython Closed Closed Copy link Labels type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump DescriptionCrash reportWhat happened?Bisected to #24592. import _io class MyIO(_io.BytesIO): def __init__(self): _io.BytesIO.__init__(self) self.writes = [] def write(self, b): self.writes.append(b) tw.write("c") return len(b) buf = MyIO() tw = _io.TextIOWrapper(buf) CHUNK_SIZE = 8192 tw.write("a" * (CHUNK_SIZE - 1)) tw.write("b" * 2) tw.flush() assert b''.join(tw.buffer.writes) == b"a" * (CHUNK_SIZE - 1) + b"b" * 2 + b"c" On debug build it causes C assertion failure: If Lines 1726 to 1733 in b48a3db
_textiowrapper_writeflush() flushes self->pending_bytes contents to wrapped buffer through write() method call: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-sets self->pending_bytes and self->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
Activity
MetadataMetadataAssigneesLabelstype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump ProjectsMilestoneRelationshipsDevelopmentIssue actions | ||||||||||||||||||||||||||||||||
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |