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
a820d736
Commit
a820d736
authored
Jan 02, 2012
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Plain Diff
merge heads
parents
ae0d27f1
9200fb88
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
10 deletions
+42
-10
Doc/library/lzma.rst
Doc/library/lzma.rst
+10
-2
Lib/test/test_socket.py
Lib/test/test_socket.py
+7
-0
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/socketmodule.c
Modules/socketmodule.c
+21
-8
No files found.
Doc/library/lzma.rst
View file @
a820d736
...
@@ -120,8 +120,16 @@ Compressing and decompressing data in memory
...
@@ -120,8 +120,16 @@ Compressing and decompressing data in memory
``9`` (inclusive), optionally OR-ed with the constant
``9`` (inclusive), optionally OR-ed with the constant
:const:`PRESET_EXTREME`. If neither *preset* nor *filters* are given, the
:const:`PRESET_EXTREME`. If neither *preset* nor *filters* are given, the
default behavior is to use :const:`PRESET_DEFAULT` (preset level ``6``).
default behavior is to use :const:`PRESET_DEFAULT` (preset level ``6``).
Higher presets produce smaller output, but make compression more CPU- and
Higher presets produce smaller output, but make the compression process
memory-intensive, and also increase the memory required for decompression.
slower.
.. note::
In addition to being more CPU-intensive, compression with higher presets
also requires much more memory (and produces output that needs more memory
to decompress). With preset ``9`` for example, the overhead for an
:class:`LZMACompressor` object can be as high as 800MiB. For this reason,
it is generally best to stick with the default preset.
The *filters* argument (if provided) should be a filter chain specifier.
The *filters* argument (if provided) should be a filter chain specifier.
See :ref:`filter-chain-specs` for details.
See :ref:`filter-chain-specs` for details.
...
...
Lib/test/test_socket.py
View file @
a820d736
...
@@ -1248,6 +1248,13 @@ class GeneralModuleTests(unittest.TestCase):
...
@@ -1248,6 +1248,13 @@ class GeneralModuleTests(unittest.TestCase):
srv
.
listen
(
0
)
srv
.
listen
(
0
)
srv
.
close
()
srv
.
close
()
@
unittest
.
skipUnless
(
support
.
IPV6_ENABLED
,
'IPv6 required for this test.'
)
def
test_flowinfo
(
self
):
self
.
assertRaises
(
OverflowError
,
socket
.
getnameinfo
,
(
'::1'
,
0
,
0xffffffff
),
0
)
with
socket
.
socket
(
socket
.
AF_INET6
,
socket
.
SOCK_STREAM
)
as
s
:
self
.
assertRaises
(
OverflowError
,
s
.
bind
,
(
'::1'
,
0
,
-
10
))
@
unittest
.
skipUnless
(
HAVE_SOCKET_CAN
,
'SocketCan required for this test.'
)
@
unittest
.
skipUnless
(
HAVE_SOCKET_CAN
,
'SocketCan required for this test.'
)
class
BasicCANTest
(
unittest
.
TestCase
):
class
BasicCANTest
(
unittest
.
TestCase
):
...
...
Misc/ACKS
View file @
a820d736
...
@@ -698,6 +698,7 @@ John Nagle
...
@@ -698,6 +698,7 @@ John Nagle
Takahiro Nakayama
Takahiro Nakayama
Travers Naran
Travers Naran
Charles-François Natali
Charles-François Natali
Vilmos Nebehaj
Fredrik Nehr
Fredrik Nehr
Tony Nelson
Tony Nelson
Trent Nelson
Trent Nelson
...
...
Misc/NEWS
View file @
a820d736
...
@@ -1744,6 +1744,9 @@ Tools/Demos
...
@@ -1744,6 +1744,9 @@ Tools/Demos
Extension
Modules
Extension
Modules
-----------------
-----------------
-
Issue
#
9975
:
socket
:
Fix
incorrect
use
of
flowinfo
and
scope_id
.
Patch
by
Vilmos
Nebehaj
.
-
Issue
#
7777
:
socket
:
Add
Reliable
Datagram
Sockets
(
PF_RDS
)
support
.
-
Issue
#
7777
:
socket
:
Add
Reliable
Datagram
Sockets
(
PF_RDS
)
support
.
-
Issue
#
13159
:
FileIO
and
BZ2Compressor
/
BZ2Decompressor
now
use
a
linear
-
time
-
Issue
#
13159
:
FileIO
and
BZ2Compressor
/
BZ2Decompressor
now
use
a
linear
-
time
...
...
Modules/socketmodule.c
View file @
a820d736
...
@@ -1095,10 +1095,10 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto)
...
@@ -1095,10 +1095,10 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto)
PyObject
*
ret
=
NULL
;
PyObject
*
ret
=
NULL
;
if
(
addrobj
)
{
if
(
addrobj
)
{
a
=
(
struct
sockaddr_in6
*
)
addr
;
a
=
(
struct
sockaddr_in6
*
)
addr
;
ret
=
Py_BuildValue
(
"Oi
ii
"
,
ret
=
Py_BuildValue
(
"Oi
II
"
,
addrobj
,
addrobj
,
ntohs
(
a
->
sin6_port
),
ntohs
(
a
->
sin6_port
),
a
->
sin6_flowinfo
,
ntohl
(
a
->
sin6_flowinfo
)
,
a
->
sin6_scope_id
);
a
->
sin6_scope_id
);
Py_DECREF
(
addrobj
);
Py_DECREF
(
addrobj
);
}
}
...
@@ -1386,7 +1386,8 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
...
@@ -1386,7 +1386,8 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
{
{
struct
sockaddr_in6
*
addr
;
struct
sockaddr_in6
*
addr
;
char
*
host
;
char
*
host
;
int
port
,
flowinfo
,
scope_id
,
result
;
int
port
,
result
;
unsigned
int
flowinfo
,
scope_id
;
flowinfo
=
scope_id
=
0
;
flowinfo
=
scope_id
=
0
;
if
(
!
PyTuple_Check
(
args
))
{
if
(
!
PyTuple_Check
(
args
))
{
PyErr_Format
(
PyErr_Format
(
...
@@ -1396,7 +1397,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
...
@@ -1396,7 +1397,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
Py_TYPE
(
args
)
->
tp_name
);
Py_TYPE
(
args
)
->
tp_name
);
return
0
;
return
0
;
}
}
if
(
!
PyArg_ParseTuple
(
args
,
"eti|
ii
"
,
if
(
!
PyArg_ParseTuple
(
args
,
"eti|
II
"
,
"idna"
,
&
host
,
&
port
,
&
flowinfo
,
"idna"
,
&
host
,
&
port
,
&
flowinfo
,
&
scope_id
))
{
&
scope_id
))
{
return
0
;
return
0
;
...
@@ -1413,9 +1414,15 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
...
@@ -1413,9 +1414,15 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
"getsockaddrarg: port must be 0-65535."
);
"getsockaddrarg: port must be 0-65535."
);
return
0
;
return
0
;
}
}
if
(
flowinfo
<
0
||
flowinfo
>
0xfffff
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"getsockaddrarg: flowinfo must be 0-1048575."
);
return
0
;
}
addr
->
sin6_family
=
s
->
sock_family
;
addr
->
sin6_family
=
s
->
sock_family
;
addr
->
sin6_port
=
htons
((
short
)
port
);
addr
->
sin6_port
=
htons
((
short
)
port
);
addr
->
sin6_flowinfo
=
flowinfo
;
addr
->
sin6_flowinfo
=
htonl
(
flowinfo
)
;
addr
->
sin6_scope_id
=
scope_id
;
addr
->
sin6_scope_id
=
scope_id
;
*
len_ret
=
sizeof
*
addr
;
*
len_ret
=
sizeof
*
addr
;
return
1
;
return
1
;
...
@@ -4939,7 +4946,8 @@ socket_getnameinfo(PyObject *self, PyObject *args)
...
@@ -4939,7 +4946,8 @@ socket_getnameinfo(PyObject *self, PyObject *args)
PyObject
*
sa
=
(
PyObject
*
)
NULL
;
PyObject
*
sa
=
(
PyObject
*
)
NULL
;
int
flags
;
int
flags
;
char
*
hostp
;
char
*
hostp
;
int
port
,
flowinfo
,
scope_id
;
int
port
;
unsigned
int
flowinfo
,
scope_id
;
char
hbuf
[
NI_MAXHOST
],
pbuf
[
NI_MAXSERV
];
char
hbuf
[
NI_MAXHOST
],
pbuf
[
NI_MAXSERV
];
struct
addrinfo
hints
,
*
res
=
NULL
;
struct
addrinfo
hints
,
*
res
=
NULL
;
int
error
;
int
error
;
...
@@ -4953,9 +4961,14 @@ socket_getnameinfo(PyObject *self, PyObject *args)
...
@@ -4953,9 +4961,14 @@ socket_getnameinfo(PyObject *self, PyObject *args)
"getnameinfo() argument 1 must be a tuple"
);
"getnameinfo() argument 1 must be a tuple"
);
return
NULL
;
return
NULL
;
}
}
if
(
!
PyArg_ParseTuple
(
sa
,
"si|
ii
"
,
if
(
!
PyArg_ParseTuple
(
sa
,
"si|
II
"
,
&
hostp
,
&
port
,
&
flowinfo
,
&
scope_id
))
&
hostp
,
&
port
,
&
flowinfo
,
&
scope_id
))
return
NULL
;
return
NULL
;
if
(
flowinfo
<
0
||
flowinfo
>
0xfffff
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"getsockaddrarg: flowinfo must be 0-1048575."
);
return
NULL
;
}
PyOS_snprintf
(
pbuf
,
sizeof
(
pbuf
),
"%d"
,
port
);
PyOS_snprintf
(
pbuf
,
sizeof
(
pbuf
),
"%d"
,
port
);
memset
(
&
hints
,
0
,
sizeof
(
hints
));
memset
(
&
hints
,
0
,
sizeof
(
hints
));
hints
.
ai_family
=
AF_UNSPEC
;
hints
.
ai_family
=
AF_UNSPEC
;
...
@@ -4990,7 +5003,7 @@ socket_getnameinfo(PyObject *self, PyObject *args)
...
@@ -4990,7 +5003,7 @@ socket_getnameinfo(PyObject *self, PyObject *args)
{
{
struct
sockaddr_in6
*
sin6
;
struct
sockaddr_in6
*
sin6
;
sin6
=
(
struct
sockaddr_in6
*
)
res
->
ai_addr
;
sin6
=
(
struct
sockaddr_in6
*
)
res
->
ai_addr
;
sin6
->
sin6_flowinfo
=
flowinfo
;
sin6
->
sin6_flowinfo
=
htonl
(
flowinfo
)
;
sin6
->
sin6_scope_id
=
scope_id
;
sin6
->
sin6_scope_id
=
scope_id
;
break
;
break
;
}
}
...
...
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