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
b57a2203
Commit
b57a2203
authored
Mar 31, 2006
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #1250170, Patch #1462230: handle socket.gethostname()
failures gracefully
parent
fbfb36a4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
Lib/mimetools.py
Lib/mimetools.py
+4
-1
Lib/test/test_urllib2.py
Lib/test/test_urllib2.py
+10
-4
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/mimetools.py
View file @
b57a2203
...
...
@@ -127,7 +127,10 @@ def choose_boundary():
import
time
if
_prefix
is
None
:
import
socket
try
:
hostid
=
socket
.
gethostbyname
(
socket
.
gethostname
())
except
socket
.
gaierror
:
hostid
=
'127.0.0.1'
try
:
uid
=
repr
(
os
.
getuid
())
except
AttributeError
:
...
...
Lib/test/test_urllib2.py
View file @
b57a2203
...
...
@@ -349,13 +349,19 @@ class HandlerTests(unittest.TestCase):
TESTFN
=
test_support
.
TESTFN
urlpath
=
sanepathname2url
(
os
.
path
.
abspath
(
TESTFN
))
towrite
=
"hello, world
\
n
"
for
url
in
[
urls
=
[
"file://localhost%s"
%
urlpath
,
"file://%s"
%
urlpath
,
"file://%s%s"
%
(
socket
.
gethostbyname
(
'localhost'
),
urlpath
),
"file://%s%s"
%
(
socket
.
gethostbyname
(
socket
.
gethostname
()),
urlpath
),
]:
]
try
:
localaddr
=
socket
.
gethostbyname
(
socket
.
gethostname
())
except
socket
.
gaierror
:
localaddr
=
''
if
localaddr
:
urls
.
append
(
"file://%s%s"
%
(
localaddr
,
urlpath
))
for
url
in
urls
:
f
=
open
(
TESTFN
,
"wb"
)
try
:
try
:
...
...
Misc/NEWS
View file @
b57a2203
...
...
@@ -485,6 +485,9 @@ Extension Modules
Library
-------
- Bug #1250170: mimetools now gracefully handles socket.gethostname()
failures gracefully.
- patch #1457316: "setup.py upload" now supports --identity to select the
key to be used for signing the uploaded code.
...
...
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