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
d2e3ba7a
Commit
d2e3ba7a
authored
Aug 26, 2005
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patch [ 756021 ] Allow socket.inet_aton("255.255.255.255") on Windows
parent
4550b8db
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
9 deletions
+19
-9
Lib/test/test_socket.py
Lib/test/test_socket.py
+2
-0
Misc/NEWS
Misc/NEWS
+5
-2
Modules/socketmodule.c
Modules/socketmodule.c
+12
-7
No files found.
Lib/test/test_socket.py
View file @
d2e3ba7a
...
...
@@ -380,10 +380,12 @@ class GeneralModuleTests(unittest.TestCase):
self
.
assertEquals
(
'
\
xff
\
x00
\
xff
\
x00
'
,
f
(
'255.0.255.0'
))
self
.
assertEquals
(
'
\
xaa
\
xaa
\
xaa
\
xaa
'
,
f
(
'170.170.170.170'
))
self
.
assertEquals
(
'
\
x01
\
x02
\
x03
\
x04
'
,
f
(
'1.2.3.4'
))
self
.
assertEquals
(
'
\
xff
\
xff
\
xff
\
xff
'
,
f
(
'255.255.255.255'
))
self
.
assertEquals
(
'
\
x00
\
x00
\
x00
\
x00
'
,
g
(
'0.0.0.0'
))
self
.
assertEquals
(
'
\
xff
\
x00
\
xff
\
x00
'
,
g
(
'255.0.255.0'
))
self
.
assertEquals
(
'
\
xaa
\
xaa
\
xaa
\
xaa
'
,
g
(
'170.170.170.170'
))
self
.
assertEquals
(
'
\
xff
\
xff
\
xff
\
xff
'
,
g
(
'255.255.255.255'
))
def
testIPv6toString
(
self
):
if
not
hasattr
(
socket
,
'inet_pton'
):
...
...
Misc/NEWS
View file @
d2e3ba7a
...
...
@@ -133,9 +133,12 @@ Core and builtins
Extension
Modules
-----------------
-
Bug
#
1191043
:
Fix
bz2
.
BZ2File
.
seek
()
for
64
-
bit
file
offsets
.
-
Patch
#
756021
:
Special
-
case
socket
.
inet_aton
(
'255.255.255.255'
)
for
platforms
that
don
't have inet_aton().
-
Bug
#
1215928
:
Fix
bz2
.
BZ2File
.(
x
)
readlines
for
files
containing
one
- Bug #1215928: Fix bz2.BZ2File.seek() for 64-bit file offsets.
- Bug #1191043: Fix bz2.BZ2File.(x)readlines for files containing one
line without newlines.
- Bug #728515: mmap.resize() now resizes the file on Unix as it did
...
...
Modules/socketmodule.c
View file @
d2e3ba7a
...
...
@@ -3238,14 +3238,19 @@ socket_inet_aton(PyObject *self, PyObject *args)
return
NULL
;
#else
/* ! HAVE_INET_ATON */
/* XXX Problem here: inet_aton('255.255.255.255') raises
an exception while it should be a valid address. */
packed_addr
=
inet_addr
(
ip_addr
);
/* special-case this address as inet_addr might return INADDR_NONE
* for this */
if
(
strcmp
(
ip_addr
,
"255.255.255.255"
)
==
0
)
{
packed_addr
=
0xFFFFFFFF
;
}
else
{
packed_addr
=
inet_addr
(
ip_addr
);
if
(
packed_addr
==
INADDR_NONE
)
{
/* invalid address */
PyErr_SetString
(
socket_error
,
"illegal IP address string passed to inet_aton"
);
return
NULL
;
if
(
packed_addr
==
INADDR_NONE
)
{
/* invalid address */
PyErr_SetString
(
socket_error
,
"illegal IP address string passed to inet_aton"
);
return
NULL
;
}
}
return
PyString_FromStringAndSize
((
char
*
)
&
packed_addr
,
sizeof
(
packed_addr
));
...
...
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