Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
311b2a67
Commit
311b2a67
authored
Feb 19, 2013
by
R David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#6623: Add explicit deprecation warning for ftplib.Netrc.
parent
fb96d12e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
Lib/ftplib.py
Lib/ftplib.py
+3
-0
Lib/test/test_ftplib.py
Lib/test/test_ftplib.py
+12
-1
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/ftplib.py
View file @
311b2a67
...
...
@@ -39,6 +39,7 @@ python ftplib.py -d localhost -l -p -l
import
os
import
sys
import
socket
import
warnings
from
socket
import
_GLOBAL_DEFAULT_TIMEOUT
__all__
=
[
"FTP"
,
"Netrc"
]
...
...
@@ -953,6 +954,8 @@ class Netrc:
__defacct = None
def __init__(self, filename=None):
warnings.warn("This class is deprecated, use the netrc module instead",
DeprecationWarning, 2)
if filename is None:
if "HOME" in os.environ:
filename = os.path.join(os.environ["HOME"],
...
...
Lib/test/test_ftplib.py
View file @
311b2a67
...
...
@@ -985,8 +985,19 @@ class TestTimeouts(TestCase):
ftp
.
close
()
class
TestNetrcDeprecation
(
TestCase
):
def
test_deprecation
(
self
):
with
support
.
temp_cwd
(),
support
.
EnvironmentVarGuard
()
as
env
:
env
[
'HOME'
]
=
os
.
getcwd
()
open
(
'.netrc'
,
'w'
).
close
()
with
self
.
assertWarns
(
DeprecationWarning
):
ftplib
.
Netrc
()
def
test_main
():
tests
=
[
TestFTPClass
,
TestTimeouts
]
tests
=
[
TestFTPClass
,
TestTimeouts
,
TestNetrcDeprecation
]
if
support
.
IPV6_ENABLED
:
tests
.
append
(
TestIPv6Environment
)
...
...
Misc/NEWS
View file @
311b2a67
...
...
@@ -260,6 +260,9 @@ Core and Builtins
Library
-------
-
Issue
#
6623
:
Added
explicit
DeprecationWarning
for
ftplib
.
netrc
,
which
has
been
deprecated
and
undocumented
for
a
long
time
.
-
Issue
#
13700
:
Fix
byte
/
string
handling
in
imaplib
authentication
when
an
authobject
is
specified
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment