GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — io.TextIOBase.buffer is not necessarily a buffer · Issue #85045 · python/cpython

io.TextIOBase.buffer is not necessarily a buffer #85045

New issue
Copy link
New issue
Copy link
Closed
Closed
io.TextIOBase.buffer is not necessarily a buffer#85045
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtopic-IO

Description

manueljacob
mannequin
opened on Jun 5, 2020
Issue body actions
BPO 40868
Nosy @manueljacob

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 = None
created_at = <Date 2020-06-05.01:15:31.315>
labels = ['expert-IO', 'docs']
title = 'io.TextIOBase.buffer is not necessarily a buffer'
updated_at = <Date 2020-06-05.01:15:31.315>
user = 'https://github.com/manueljacob'

bugs.python.org fields:

activity = <Date 2020-06-05.01:15:31.315>
actor = 'mjacob'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation', 'IO']
creation = <Date 2020-06-05.01:15:31.315>
creator = 'mjacob'
dependencies = []
files = []
hgrepos = []
issue_num = 40868
keywords = []
message_count = 1.0
messages = ['370744']
nosy_count = 2.0
nosy_names = ['docs@python', 'mjacob']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue40868'
versions = []

Linked PRs

  • gh-85045: clarified that the underlying buffer of a TextIOBase can be a RawIOBase #134372
  • [3.14] gh-85045: clarified that the underlying buffer of a TextIOBase can be a RawIOBase (GH-134372) #134374
  • [3.13] gh-85045: clarified that the underlying buffer of a TextIOBase can be a RawIOBase (GH-134372) #134375
Reacted by Shahriar Heidrich

Activity

  1. manueljacob commented on Jun 5, 2020

    @manueljacob
    manueljacobmannequin
    on Jun 5, 2020
    MannequinAuthor
    More actions

    https://docs.python.org/dev/library/io.html#io.TextIOBase.buffer says:

    "The underlying binary buffer (a BufferedIOBase instance) that TextIOBase deals with. This is not part of the TextIOBase API and may not exist in some implementations."

    It is not necessarily a buffer (a BufferedIOBase instance), e.g. when the stdout and stderr streams are set to be unbuffered. Example:

    % python -u
    Python 3.8.3 (default, May 17 2020, 18:15:42) 
    [GCC 10.1.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import io, sys
    >>> sys.stdout
    <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
    >>> isinstance(sys.stdout, io.TextIOBase)
    True
    >>> sys.stdout.buffer
    <_io.FileIO name='<stdout>' mode='wb' closefd=False>
    >>> isinstance(sys.stdout.buffer, io.BufferedIOBase)
    False

    Therefore the name and the documentation are incorrect.

    I suggest to deprecate the attribute "buffer", introduce a new attribute with a correct name, and forward the old attribute to the new attribute and vice versa in the io.TextIOBase class.

    I think that "binary" would be a good attribute name for the underlying binary stream, as it would be consistent with io.BufferedIOBase.raw (for "the underlying raw stream").

  2. manueljacob
    assigned
    docspython
    on Jun 5, 2020
  3. manueljacob
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    topic-IO
    on Jun 5, 2020
  4. manueljacob
    assigned
    docspython
    on Jun 5, 2020
  5. manueljacob
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    topic-IO
    on Jun 5, 2020
  6. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  7. AlexKautz commented on May 20, 2025

    @AlexKautz
    AlexKautz
    on May 20, 2025
    More actions

    I'll grab this.
    [Hello from PyCon Sprints]
    Focus on just updating the documentation rather than introducing any breaking changes.

    Reacted by Shahriar Heidrich
    Reacted by Shahriar Heidrich
    Reacted by Shahriar Heidrich
  8. gpshead
    added a commit that references this issue on May 20, 2025

    gh-85045: clarified that the underlying buffer of a TextIOBase can be…

    36eb711
  9. miss-islington
    added 2 commits that reference this issue on May 20, 2025

    pythongh-85045: clarified that the underlying buffer of a TextIOBase …

    d495021

    pythongh-85045: clarified that the underlying buffer of a TextIOBase …

    5a6c3dc
  10. gpshead
    added 2 commits that reference this issue on May 20, 2025

    [3.14] gh-85045: clarified that the underlying buffer of a TextIOBase…

    899ce7d

    [3.13] gh-85045: clarified that the underlying buffer of a TextIOBase…

    7df6749
  11. gpshead commented on May 20, 2025

    @gpshead
    gpshead
    on May 20, 2025
    Member
    More actions

    thanks!

  12. gpshead
    closed this as completedon May 20, 2025
  13. lkollar
    added a commit that references this issue on May 26, 2025

    pythongh-85045: clarified that the underlying buffer of a TextIOBase …

    2170fab
  14. Pranjal095
    added a commit that references this issue on Jul 12, 2025

    pythongh-85045: clarified that the underlying buffer of a TextIOBase …

    85c2bd6
  15. taegyunkim
    added a commit that references this issue on Aug 4, 2025

    pythongh-85045: clarified that the underlying buffer of a TextIOBase …

    02cc7bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirDocumentation in the Doc dirtopic-IO

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — 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.