Skip to content

Assertion failure in Modules/_io/textio.c _io_TextIOWrapper_tell_impl: Assertion 'skip_back <= PyBytes_GET_SIZE(next_input)' failed #141314

@YuanchengJiang

Description

@YuanchengJiang

Bug report

Bug description:

import io
import os
from test.support import os_helper

DATA_TEMPLATE = ['line1=1']
DATA_CR = r'\n\r\t'.join(DATA_TEMPLATE) + '\r'

open_func = io.open

READMODE = 'r'
WRITEMODE = 'wb'

data = DATA_CR
if 'b' in WRITEMODE:
    data = data.encode('ascii')

with open_func(os_helper.TESTFN, WRITEMODE) as fp:
    fp.write(data)

with open_func(os_helper.TESTFN, READMODE) as fp:
    _ = fp.readline()
    pos = fp.tell()
python: ../Modules/_io/textio.c:2848: _io_TextIOWrapper_tell_impl: Assertion `skip_back <= PyBytes_GET_SIZE(next_input)' failed.
Aborted (core dumped)

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtopic-IOtype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions