Skip to content
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

codec readline() splits lines apart #41415

Closed
irmen mannequin opened this issue Jan 9, 2005 · 3 comments
Closed

codec readline() splits lines apart #41415

irmen mannequin opened this issue Jan 9, 2005 · 3 comments
Labels
stdlib Python modules in the Lib dir

Comments

@irmen
Copy link
Mannequin

irmen mannequin commented Jan 9, 2005

BPO 1098990
Nosy @doerwalter, @irmen
Files
  • example.txt: example shell session that shows the problem
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2005-01-10.12:26:47.000>
    created_at = <Date 2005-01-09.16:45:57.000>
    labels = ['library']
    title = 'codec readline() splits lines apart'
    updated_at = <Date 2005-01-10.12:26:47.000>
    user = 'https://github.com/irmen'

    bugs.python.org fields:

    activity = <Date 2005-01-10.12:26:47.000>
    actor = 'doerwalter'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2005-01-09.16:45:57.000>
    creator = 'irmen'
    dependencies = []
    files = ['1554']
    hgrepos = []
    issue_num = 1098990
    keywords = []
    message_count = 3.0
    messages = ['23904', '23905', '23906']
    nosy_count = 2.0
    nosy_names = ['doerwalter', 'irmen']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1098990'
    versions = ['Python 2.5']

    @irmen
    Copy link
    Mannequin Author

    irmen mannequin commented Jan 9, 2005

    It seems that the fix for bug 1076985 (Incorrect
    behaviour of StreamReader.readline leads to crash) has
    introduced a new bug.
    using current cvs Python on Linux, I observe faulty
    behavior of the readline() method on file-like objects
    returned from the codecs module.
    See the attached example.txt.
    The readline() breaks certain lines in half.
    It only happens when a certain encoding is used, so regular
    file objects behave as expected. Also, readlines()
    works fine.

    @irmen irmen mannequin closed this as completed Jan 9, 2005
    @irmen irmen mannequin added the stdlib Python modules in the Lib dir label Jan 9, 2005
    @irmen irmen mannequin closed this as completed Jan 9, 2005
    @irmen irmen mannequin added the stdlib Python modules in the Lib dir label Jan 9, 2005
    @doerwalter
    Copy link
    Contributor

    Logged In: YES
    user_id=89016

    The problem is that the first readline() reads more than the
    first line, returns the first line and puts back the rest
    for the next read. The next call to readline() discovers
    that there is already data there and doesn't call read()
    again. I'm working on a patch.

    @doerwalter
    Copy link
    Contributor

    Logged In: YES
    user_id=89016

    Checked in as:
    Lib/codecs.py 1.37
    Lib/test/test_codecs.py 1.18
    Lib/codecs.py 1.35.2.2
    Lib/test/test_codecs.py 1.15.2.2

    Thanks for the report!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant