Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(148)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 1487041: Add sendmsg(), recvmsg(), recvmsg_into() methods to Python sockets

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 7 months ago by baikie
Modified:
10 years, 1 month ago
Reviewers:
Base URL:
http://svn.python.org/view/*checkout*/python/branches/py3k/
Visibility:
Public.
From http://bugs.python.org/issue6560 Based on Heiko Wundram's patch from http://bugs.python.org/issue1194378

Patch Set 1 #

Total comments: 7

Patch Set 2 : Argh, I shouldn't have used quilt. Let's try that again. #

Patch Set 3 : Updated to use new BEGIN/END_SELECT_LOOP macros, fixed interrupted-timeout bug #

Created: 15 years, 1 month ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+3142 lines, -0 lines) Patch
Doc/library/socket.rst View 1 2 4 chunks +176 lines, -0 lines 0 comments Download
Lib/ssl.py View 1 2 2 chunks +24 lines, -0 lines 0 comments Download
Lib/test/test_socket.py View 1 2 6 chunks +2120 lines, -0 lines 0 comments Download
Lib/test/test_ssl.py View 1 2 1 chunk +13 lines, -0 lines 0 comments Download
Modules/socketmodule.c View 1 2 12 chunks +809 lines, -0 lines 0 comments Download
Total messages: 8
|
baikie
15 years, 7 months ago (2010年06月02日 22:37:09 UTC) #1
Sign in to reply to this message.
Antoine Pitrou
Here is a couple of comments that came to my mind while reading the patch. ...
15 years, 7 months ago (2010年06月10日 19:05:20 UTC) #2
Here is a couple of comments that came to my mind while reading the patch.
Overall the patch looks good, although I'm not an expert in the field.
I also tested it works fine on recent x86-64 Linux system.
http://codereview.appspot.com/1487041/diff/1/2
File Doc/library/socket.rst (right):
http://codereview.appspot.com/1487041/diff/1/2#newcode450
Doc/library/socket.rst:450: .. function:: CMSG_LEN(length)
The documentation for both CMSG_LEN and CMSG_SPACE is quite cryptic IMO. Would
it be possible to state what they are useful for?
http://codereview.appspot.com/1487041/diff/1/5
File Lib/test/test_socket.py (right):
http://codereview.appspot.com/1487041/diff/1/5#newcode389
Lib/test/test_socket.py:389: class TCPTestBase(InetTestBase):
Is such a forest of subclasses and mixins really needed? For example, TCP will
always function in connected mode and UDP in connectionless mode.
http://codereview.appspot.com/1487041/diff/1/5#newcode1297
Lib/test/test_socket.py:1297: self.assertIsNone(cm.exception.errno)
This line should be indented to the left, otherwise it doesn't get executed (the
previous line raises an error and leaves the "with" scope).
Sign in to reply to this message.
baikie
Thanks for wading through the patch - especially all that test code. I've been testing ...
15 years, 7 months ago (2010年06月10日 21:50:48 UTC) #3
Thanks for wading through the patch - especially all that test code. I've been
testing on 32-bit only, so it's good to know that it works on 64-bit Linux.
http://codereview.appspot.com/1487041/diff/1/2
File Doc/library/socket.rst (right):
http://codereview.appspot.com/1487041/diff/1/2#newcode450
Doc/library/socket.rst:450: .. function:: CMSG_LEN(length)
On 2010年06月10日 19:05:20, Antoine Pitrou wrote:
> The documentation for both CMSG_LEN and CMSG_SPACE is quite cryptic IMO. Would
> it be possible to state what they are useful for?
Yes, I suppose it doesn't make much sense if you haven't read the recvmsg()
docs. I could perhaps add something about the need to restrict the amount of
ancillary data received.
Using CMSG_LEN() to size the ancillary buffer is actually not officially
sanctioned, but CMSG_SPACE() might leave too much space and allow an unwanted
extra file descriptor to be received, for example (I haven't actually seen this,
but I presume it can happen on a 64-bit system).
http://codereview.appspot.com/1487041/diff/1/5
File Lib/test/test_socket.py (right):
http://codereview.appspot.com/1487041/diff/1/5#newcode389
Lib/test/test_socket.py:389: class TCPTestBase(InetTestBase):
On 2010年06月10日 19:05:20, Antoine Pitrou wrote:
> Is such a forest of subclasses and mixins really needed? For example, TCP will
> always function in connected mode and UDP in connectionless mode.
Perhaps it could be tidied up, but I modelled them on the existing classes such
as SocketTCPTest and SocketConnectedTest with a view to replacing those
(SocketTCPTest doesn't connect the socket). I just didn't want to make the
patch actually delete them yet.
You can actually connect a UDP socket - it will then report the errors you got
from ICMP or the local network stack, etc. I don't know, maybe I should have
tested sendmsg with that as well :)
http://codereview.appspot.com/1487041/diff/1/5#newcode1297
Lib/test/test_socket.py:1297: self.assertIsNone(cm.exception.errno)
On 2010年06月10日 19:05:20, Antoine Pitrou wrote:
> This line should be indented to the left, otherwise it doesn't get executed
(the
> previous line raises an error and leaves the "with" scope).
Well spotted, thanks.
Sign in to reply to this message.
Antoine Pitrou
I forgot one small thing. http://codereview.appspot.com/1487041/diff/1/5 File Lib/test/test_socket.py (right): http://codereview.appspot.com/1487041/diff/1/5#newcode1041 Lib/test/test_socket.py:1041: class TestError(Exception): You don't ...
15 years, 7 months ago (2010年06月12日 17:18:21 UTC) #4
I forgot one small thing.
http://codereview.appspot.com/1487041/diff/1/5
File Lib/test/test_socket.py (right):
http://codereview.appspot.com/1487041/diff/1/5#newcode1041
Lib/test/test_socket.py:1041: class TestError(Exception):
You don't need this. Just use self.fail().
Sign in to reply to this message.
baikie
Here is a revised version of the patch. I've done some minor cleanup in the ...
15 years, 7 months ago (2010年06月13日 19:49:48 UTC) #5
Here is a revised version of the patch. I've done some minor cleanup in the
tests, fixed the cm.exception.errno line, and clarified the CMSG_*() docs and
made them link to recvmsg().
The TestError thing in checkFlags is meant to indicate an incorrectly-written
test rather than a failing one. I can't remember why I made a new exception for
it though, so I've just made it raise Exception (so it won't get caught by
mistake).
I made a separate patch to replace SocketTCPTest, etc. with the base/mixin
classes from the sendmsg patch, which I'll post back at the Tracker. With that
done, I didn't see an obvious way to reduce the number of classes, except
perhaps making the stream servers listen unconditionally, or merging
ThreadedSocketTestMixin into the base (but then all the tests would need
threading available).
Sign in to reply to this message.
baikie
Revised version of patch
15 years, 7 months ago (2010年06月13日 19:50:18 UTC) #6
Revised version of patch
Sign in to reply to this message.
baikie
Argh, I shouldn't have used quilt. Let's try that again.
15 years, 7 months ago (2010年06月13日 19:56:52 UTC) #7
Argh, I shouldn't have used quilt. Let's try that again.
Sign in to reply to this message.
baikie
Updated to use new BEGIN/END_SELECT_LOOP macros, fixed interrupted-timeout bug
15 years, 1 month ago (2010年12月06日 19:52:34 UTC) #8
Updated to use new BEGIN/END_SELECT_LOOP macros, fixed interrupted-timeout bug
Sign in to reply to this message.
|
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /