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

TextIOWrapper(newline="\n", line_buffering=True) mistakenly treat \r as a newline #66267

Closed
4kir4 mannequin opened this issue Jul 25, 2014 · 8 comments
Closed

TextIOWrapper(newline="\n", line_buffering=True) mistakenly treat \r as a newline #66267

4kir4 mannequin opened this issue Jul 25, 2014 · 8 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes docs Documentation in the Doc dir easy topic-IO type-bug An unexpected behavior, bug, or error

Comments

@4kir4
Copy link
Mannequin

4kir4 mannequin commented Jul 25, 2014

BPO 22069
Nosy @benjaminp, @4kir4, @hynek, @serhiy-storchaka, @elenaoat, @Mariatta, @miss-islington
PRs
  • bpo-22069: Flush is implied also when write contains a carriage return #6609
  • [3.7] bpo-22069: Update TextIO documentation (GH-6609) #6801
  • [2.7] bpo-22069: Update TextIO documentation (GH-6609) #6802
  • [3.6] bpo-22069: Update TextIO documentation (GH-6609) #6803
  • 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 2018-05-14.16:25:06.831>
    created_at = <Date 2014-07-25.16:43:43.732>
    labels = ['easy', 'type-bug', '3.8', 'expert-IO', '3.7', 'docs']
    title = 'TextIOWrapper(newline="\\n", line_buffering=True) mistakenly treat \\r as a newline'
    updated_at = <Date 2018-05-14.16:25:15.167>
    user = 'https://github.com/4kir4'

    bugs.python.org fields:

    activity = <Date 2018-05-14.16:25:15.167>
    actor = 'Mariatta'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2018-05-14.16:25:06.831>
    closer = 'Mariatta'
    components = ['Documentation', 'IO']
    creation = <Date 2014-07-25.16:43:43.732>
    creator = 'akira'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 22069
    keywords = ['patch', 'easy']
    message_count = 8.0
    messages = ['223965', '224078', '315785', '316513', '316528', '316529', '316530', '316534']
    nosy_count = 9.0
    nosy_names = ['benjamin.peterson', 'stutzbach', 'docs@python', 'akira', 'hynek', 'serhiy.storchaka', 'Elena.Oat', 'Mariatta', 'miss-islington']
    pr_nums = ['6609', '6801', '6802', '6803']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue22069'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @4kir4
    Copy link
    Mannequin Author

    4kir4 mannequin commented Jul 25, 2014

    TextIOWrapper(b, newline="\n", line_buffering=True) object calls flush()
    while writing "\r". See test_line_buffering() method in
    Lib/test/test_io.py:2114

    The documentation says [1]:

    If line_buffering is True, flush() is implied when a call to write contains
    a newline character.

    i.e., writing \r shouldn't force flush() if newline="\n"

    [1] https://docs.python.org/3.4/library/io.html#io.TextIOWrapper

    @4kir4 4kir4 mannequin added topic-IO type-bug An unexpected behavior, bug, or error labels Jul 25, 2014
    @serhiy-storchaka
    Copy link
    Member

    Looks as this behavior is intentional. Documentation should be corrected.

    @serhiy-storchaka serhiy-storchaka added the docs Documentation in the Doc dir label Jul 26, 2014
    @csabella csabella added easy 3.7 (EOL) end of life 3.8 only security fixes labels Apr 25, 2018
    @elenaoat
    Copy link
    Mannequin

    elenaoat mannequin commented Apr 26, 2018

    Note that the correct link to the test case is:
    https://github.com/python/cpython/blob/master/Lib/test/test_io.py#L2565

    @Mariatta
    Copy link
    Member

    New changeset 7ffd4c5 by Mariatta (Elena Oat) in branch 'master':
    bpo-22069: Update TextIO documentation (GH-6609)
    7ffd4c5

    @miss-islington
    Copy link
    Contributor

    New changeset 050e041 by Miss Islington (bot) in branch '3.7':
    bpo-22069: Update TextIO documentation (GH-6609)
    050e041

    @miss-islington
    Copy link
    Contributor

    New changeset 84fc6c5 by Miss Islington (bot) in branch '2.7':
    bpo-22069: Update TextIO documentation (GH-6609)
    84fc6c5

    @miss-islington
    Copy link
    Contributor

    New changeset 9fd5b5f by Miss Islington (bot) in branch '3.6':
    bpo-22069: Update TextIO documentation (GH-6609)
    9fd5b5f

    @Mariatta
    Copy link
    Member

    Thanks!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes docs Documentation in the Doc dir easy topic-IO type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants