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
2024acd3
Commit
2024acd3
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
e44b1258
Changes
1
Hide 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 @
2024acd3
...
...
@@ -2136,7 +2136,7 @@ class ftpwrapper:
# Try to retrieve as a file
try
:
cmd
=
'RETR '
+
file
conn
=
self
.
ftp
.
ntransfercmd
(
cmd
)
conn
,
retrlen
=
self
.
ftp
.
ntransfercmd
(
cmd
)
except
ftplib
.
error_perm
as
reason
:
if
str
(
reason
)[:
3
]
!=
'550'
:
raise
URLError
(
'ftp error'
,
reason
).
with_traceback
(
...
...
@@ -2157,10 +2157,14 @@ class ftpwrapper:
cmd
=
'LIST '
+
file
else
:
cmd
=
'LIST'
conn
=
self
.
ftp
.
ntransfercmd
(
cmd
)
conn
,
retrlen
=
self
.
ftp
.
ntransfercmd
(
cmd
)
self
.
busy
=
1
ftpobj
=
addclosehook
(
conn
.
makefile
(
'rb'
),
self
.
endtransfer
)
conn
.
close
()
# 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
):
if
not
self
.
busy
:
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