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
459bae89
Commit
459bae89
authored
Mar 24, 2011
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue10883 - Silence some ftp related ResourceWarnings in test_urllib2net. Patch by Nadeem Vawda.
parent
945f8ef9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
Lib/urllib/request.py
Lib/urllib/request.py
+7
-3
No files found.
Lib/urllib/request.py
View file @
459bae89
...
@@ -2136,7 +2136,7 @@ class ftpwrapper:
...
@@ -2136,7 +2136,7 @@ class ftpwrapper:
# Try to retrieve as a file
# Try to retrieve as a file
try
:
try
:
cmd
=
'RETR '
+
file
cmd
=
'RETR '
+
file
conn
=
self
.
ftp
.
ntransfercmd
(
cmd
)
conn
,
retrlen
=
self
.
ftp
.
ntransfercmd
(
cmd
)
except
ftplib
.
error_perm
as
reason
:
except
ftplib
.
error_perm
as
reason
:
if
str
(
reason
)[:
3
]
!=
'550'
:
if
str
(
reason
)[:
3
]
!=
'550'
:
raise
URLError
(
'ftp error'
,
reason
).
with_traceback
(
raise
URLError
(
'ftp error'
,
reason
).
with_traceback
(
...
@@ -2157,10 +2157,14 @@ class ftpwrapper:
...
@@ -2157,10 +2157,14 @@ class ftpwrapper:
cmd
=
'LIST '
+
file
cmd
=
'LIST '
+
file
else
:
else
:
cmd
=
'LIST'
cmd
=
'LIST'
conn
=
self
.
ftp
.
ntransfercmd
(
cmd
)
conn
,
retrlen
=
self
.
ftp
.
ntransfercmd
(
cmd
)
self
.
busy
=
1
self
.
busy
=
1
ftpobj
=
addclosehook
(
conn
.
makefile
(
'rb'
),
self
.
endtransfer
)
conn
.
close
()
# Pass back both a suitably decorated object and a retrieval length
# Pass back both a suitably decorated object and a retrieval length
return
(
addclosehook
(
conn
[
0
].
makefile
(
'rb'
),
self
.
endtransfer
),
conn
[
1
])
return
(
ftpobj
,
retrlen
)
def
endtransfer
(
self
):
def
endtransfer
(
self
):
if
not
self
.
busy
:
if
not
self
.
busy
:
return
return
...
...
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