summaryrefslogtreecommitdiff
path: root/Doc/library/netrc.rst
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2017-11-25 13:37:22 +0300
committerGitHub <noreply@github.com>2017-11-25 13:37:22 +0300
commit8d9bb11d8fcbf10cc9b1eb0a647bcf3658a4e3dd (patch)
tree96a2d24856b7ea63dfb3992125e3e90447ab52fb /Doc/library/netrc.rst
parent9d5ec808de2c1359f434cc2fa8378458e4339c96 (diff)
downloadcpython-git-8d9bb11d8fcbf10cc9b1eb0a647bcf3658a4e3dd.tar.gz
bpo-28334: netrc() now uses expanduser() to find .netrc file (GH-4537)
Previously, netrc.netrc() was raised an exception if $HOME is not set. Authored-By: Dimitri Merejkowsky <dimitri.merejkowsky@tanker.io>
Diffstat (limited to 'Doc/library/netrc.rst')
-rw-r--r--Doc/library/netrc.rst11
1 files changed, 8 insertions, 3 deletions
diff --git a/Doc/library/netrc.rst b/Doc/library/netrc.rst
index 64aa3ac7c8..3d29ac49b9 100644
--- a/Doc/library/netrc.rst
+++ b/Doc/library/netrc.rst
@@ -20,8 +20,10 @@ the Unix :program:`ftp` program and other FTP clients.
A :class:`~netrc.netrc` instance or subclass instance encapsulates data from a netrc
file. The initialization argument, if present, specifies the file to parse. If
- no argument is given, the file :file:`.netrc` in the user's home directory will
- be read. Parse errors will raise :exc:`NetrcParseError` with diagnostic
+ no argument is given, the file :file:`.netrc` in the user's home directory --
+ as determined by :func:`os.path.expanduser` -- will be read. Otherwise,
+ a :exc:`FileNotFoundError` exception will be raised.
+ Parse errors will raise :exc:`NetrcParseError` with diagnostic
information including the file name, line number, and terminating token.
If no argument is specified on a POSIX system, the presence of passwords in
the :file:`.netrc` file will raise a :exc:`NetrcParseError` if the file
@@ -32,6 +34,10 @@ the Unix :program:`ftp` program and other FTP clients.
.. versionchanged:: 3.4 Added the POSIX permission check.
+ .. versionchanged:: 3.7
+ :func:`os.path.expanduser` is used to find the location of the
+ :file:`.netrc` file when *file* is not passed as argument.
+
.. exception:: NetrcParseError
@@ -82,4 +88,3 @@ Instances of :class:`~netrc.netrc` have public instance variables:
punctuation is allowed in passwords, however, note that whitespace and
non-printable characters are not allowed in passwords. This is a limitation
of the way the .netrc file is parsed and may be removed in the future.
-