Skip to content

Commit 41e447d

Browse files
author
ssrthakkumar
committed
Doc: clarify that open() accepts objects with name attribute
1 parent d41aa7f commit 41e447d

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Doc/library/functions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ are always available. They are listed here in alphabetical order.
13461346
single: file object; open() built-in function
13471347

13481348
.. function:: open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)
1349-
1349+
`
13501350
Open *file* and return a corresponding :term:`file object`. If the file
13511351
cannot be opened, an :exc:`OSError` is raised. See
13521352
:ref:`tut-files` for more examples of how to use this function.
@@ -1367,7 +1367,7 @@ are always available. They are listed here in alphabetical order.
13671367
*encoding* is not specified the encoding used is platform-dependent:
13681368
:func:`locale.getencoding` is called to get the current locale encoding.
13691369
(For reading and writing raw bytes use binary mode and leave
1370-
*encoding* unspecified.) The available modes are:
1370+
*encoding* unspecified.) The available modes are:`
13711371

13721372
.. _filemodes:
13731373

tatus

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
2+
index cd819b8d06..cfa6d9620d 100644
3+
--- a/Doc/library/functions.rst
4+
+++ b/Doc/library/functions.rst
5+
@@ -1352,9 +1352,10 @@ are always available. They are listed here in alphabetical order.
6+
:ref:`tut-files` for more examples of how to use this function.
7+

8+
*file* is a :term:`path-like object` giving the pathname (absolute or
9+
- relative to the current working directory) of the file to be opened or an
10+
- integer file descriptor of the file to be wrapped. (If a file descriptor is
11+
- given, it is closed when the returned I/O object is closed unless *closefd*
12+
+ relative to the current working directory) of the file to be opened,
13+
+ or an object with a ``name`` attribute, or an integer file descriptor
14+
+ of the file to be wrapped. (If a file descriptor is given, 
15+
+ it is closed when the returned I/O object is closed unless *closefd*
16+
is set to ``False``.)
17+

18+
*mode* is an optional string that specifies the mode in which the file is

0 commit comments

Comments
 (0)