Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4adb288

Browse files
committed
Issue #7631: Fix undefined references to the "built-in file object", which
has ceased to be.
1 parent 6e40e27 commit 4adb288

5 files changed

Lines changed: 26 additions & 28 deletions

File tree

Doc/library/filesys.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@ in this chapter is:
2626

2727
.. seealso::
2828

29-
Section :ref:`bltin-file-objects`
30-
A description of Python's built-in file objects.
31-
3229
Module :mod:`os`
3330
Operating system interfaces, including functions to work with files at a lower
3431
level than the built-in file object.
3532

3633
Module :mod:`io`
37-
Python's framework for dealing with I/O including reading and writing
38-
files.
34+
Python's built-in I/O library, including both abstract classes and
35+
some concrete classes such as file I/O.
3936

37+
Built-in function :func:`open`
38+
The standard way to open files for reading and writing with Python.

Doc/library/socket.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,14 +575,16 @@ correspond to Unix system calls applicable to sockets.
575575

576576
.. index:: single: I/O control; buffering
577577

578-
Return a :dfn:`file object` associated with the socket. (File objects are
579-
described in :ref:`bltin-file-objects`.) The file object references a
580-
:cfunc:`dup`\ ped version of the socket file descriptor, so the file object
581-
and socket object may be closed or garbage-collected independently. The
582-
socket must be in blocking mode (it can not have a timeout). The optional
578+
Return a :dfn:`file object` associated with the socket. The exact
579+
returned type depends on the arguments given to :meth:`makefile`. These
583580
arguments are interpreted the same way as by the built-in :func:`open`
584581
function.
585582

583+
The returned file object references a :cfunc:`dup`\ ped version of the
584+
socket file descriptor, so the file object and socket object may be
585+
closed or garbage-collected independently. The socket must be in
586+
blocking mode (it can not have a timeout).
587+
586588

587589
.. method:: socket.recv(bufsize[, flags])
588590

Doc/library/tokenize.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ The primary entry point is a :term:`generator`:
1818

1919
The :func:`tokenize` generator requires one argument, *readline*, which
2020
must be a callable object which provides the same interface as the
21-
:meth:`readline` method of built-in file objects (see section
22-
:ref:`bltin-file-objects`). Each call to the function should return one
23-
line of input as bytes.
21+
:meth:`io.IOBase.readline` method of file objects. Each call to the
22+
function should return one line of input as bytes.
2423

2524
The generator produces 5-tuples with these members: the token type; the
2625
token string; a 2-tuple ``(srow, scol)`` of ints specifying the row and

Doc/reference/datamodel.rst

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -767,10 +767,10 @@ Class instances
767767
Special attributes: :attr:`__dict__` is the attribute dictionary;
768768
:attr:`__class__` is the instance's class.
769769

770-
Files
770+
I/O objects (also known as file objects)
771771
.. index::
772-
object: file
773772
builtin: open
773+
module: io
774774
single: popen() (in module os)
775775
single: makefile() (socket method)
776776
single: sys.stdin
@@ -781,14 +781,17 @@ Files
781781
single: stdout (in module sys)
782782
single: stderr (in module sys)
783783

784-
A file object represents an open file. File objects are created by the
785-
:func:`open` built-in function, and also by :func:`os.popen`,
786-
:func:`os.fdopen`, and the :meth:`makefile` method of socket objects (and
787-
perhaps by other functions or methods provided by extension modules). The
788-
objects ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are initialized to
789-
file objects corresponding to the interpreter's standard input, output and
790-
error streams. See :ref:`bltin-file-objects` for complete documentation of
791-
file objects.
784+
A file object represents an open file. Various shortcuts are available
785+
to create file objects: the :func:`open` built-in function, and also
786+
:func:`os.popen`, :func:`os.fdopen`, and the :meth:`makefile` method
787+
of socket objects (and perhaps by other functions or methods provided
788+
by extension modules).
789+
790+
The objects ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are
791+
initialized to file objects corresponding to the interpreter's standard
792+
input, output and error streams; they are all open in text mode and
793+
therefore follow the interface defined by the :class:`io.TextIOBase`
794+
abstract class.
792795

793796
Internal types
794797
.. index::

Doc/using/cmdline.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,6 @@ Miscellaneous options
235235
Force stdin, stdout and stderr to be totally unbuffered. On systems where it
236236
matters, also put stdin, stdout and stderr in binary mode.
237237

238-
Note that there is internal buffering in :meth:`file.readlines` and
239-
:ref:`bltin-file-objects` (``for line in sys.stdin``) which is not influenced
240-
by this option. To work around this, you will want to use
241-
:meth:`file.readline` inside a ``while 1:`` loop.
242-
243238
See also :envvar:`PYTHONUNBUFFERED`.
244239

245240

0 commit comments

Comments
 (0)