Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Side by Side Diff: Modules/overlapped.c

Issue 28261: wrong error messages when using PyArg_ParseTuple to parse normal tuples
Patch Set: Created 3 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Support for overlapped IO 2 * Support for overlapped IO
3 * 3 *
4 * Some code borrowed from Modules/_winapi.c of CPython 4 * Some code borrowed from Modules/_winapi.c of CPython
5 */ 5 */
6 6
7 /* XXX check overflow and DWORD <-> Py_ssize_t conversions 7 /* XXX check overflow and DWORD <-> Py_ssize_t conversions
8 Check itemsize */ 8 Check itemsize */
9 9
10 #include "Python.h" 10 #include "Python.h"
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 static int 973 static int
974 parse_address(PyObject *obj, SOCKADDR *Address, int Length) 974 parse_address(PyObject *obj, SOCKADDR *Address, int Length)
975 { 975 {
976 Py_UNICODE *Host; 976 Py_UNICODE *Host;
977 unsigned short Port; 977 unsigned short Port;
978 unsigned long FlowInfo; 978 unsigned long FlowInfo;
979 unsigned long ScopeId; 979 unsigned long ScopeId;
980 980
981 memset(Address, 0, Length); 981 memset(Address, 0, Length);
982 982
983 if (PyArg_ParseTuple(obj, "uH", &Host, &Port)) 983 if (PyArg_ParseTuple(obj, "uH", &Host, &Port))
storchaka 2017/03/03 08:34:36 Doesn't this need an error message too?
Oren Milman 2017/08/16 16:09:26 ISTM that it doesn't, because in case the first Py
storchaka 2017/08/17 15:03:26 This looks as a part of this issue to me. It can b
984 { 984 {
985 Address->sa_family = AF_INET; 985 Address->sa_family = AF_INET;
986 if (WSAStringToAddressW(Host, AF_INET, NULL, Address, &Length) < 0) { 986 if (WSAStringToAddressW(Host, AF_INET, NULL, Address, &Length) < 0) {
987 SetFromWindowsErr(WSAGetLastError()); 987 SetFromWindowsErr(WSAGetLastError());
988 return -1; 988 return -1;
989 } 989 }
990 ((SOCKADDR_IN*)Address)->sin_port = htons(Port); 990 ((SOCKADDR_IN*)Address)->sin_port = htons(Port);
991 return Length; 991 return Length;
992 } 992 }
993 else if (PyArg_ParseTuple(obj, "uHkk", &Host, &Port, &FlowInfo, &ScopeId)) 993 else if (PyArg_ParseTuple(obj,
994 "uHkk;ConnectEx: illegal address_as_bytes "
995 "argument", &Host, &Port, &FlowInfo, &ScopeId))
994 { 996 {
995 PyErr_Clear(); 997 PyErr_Clear();
996 Address->sa_family = AF_INET6; 998 Address->sa_family = AF_INET6;
997 if (WSAStringToAddressW(Host, AF_INET6, NULL, Address, &Length) < 0) { 999 if (WSAStringToAddressW(Host, AF_INET6, NULL, Address, &Length) < 0) {
998 SetFromWindowsErr(WSAGetLastError()); 1000 SetFromWindowsErr(WSAGetLastError());
999 return -1; 1001 return -1;
1000 } 1002 }
1001 ((SOCKADDR_IN6*)Address)->sin6_port = htons(Port); 1003 ((SOCKADDR_IN6*)Address)->sin6_port = htons(Port);
1002 ((SOCKADDR_IN6*)Address)->sin6_flowinfo = FlowInfo; 1004 ((SOCKADDR_IN6*)Address)->sin6_flowinfo = FlowInfo;
1003 ((SOCKADDR_IN6*)Address)->sin6_scope_id = ScopeId; 1005 ((SOCKADDR_IN6*)Address)->sin6_scope_id = ScopeId;
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 WINAPI_CONSTANT(F_DWORD, ERROR_PIPE_BUSY); 1339 WINAPI_CONSTANT(F_DWORD, ERROR_PIPE_BUSY);
1338 WINAPI_CONSTANT(F_DWORD, INFINITE); 1340 WINAPI_CONSTANT(F_DWORD, INFINITE);
1339 WINAPI_CONSTANT(F_HANDLE, INVALID_HANDLE_VALUE); 1341 WINAPI_CONSTANT(F_HANDLE, INVALID_HANDLE_VALUE);
1340 WINAPI_CONSTANT(F_HANDLE, NULL); 1342 WINAPI_CONSTANT(F_HANDLE, NULL);
1341 WINAPI_CONSTANT(F_DWORD, SO_UPDATE_ACCEPT_CONTEXT); 1343 WINAPI_CONSTANT(F_DWORD, SO_UPDATE_ACCEPT_CONTEXT);
1342 WINAPI_CONSTANT(F_DWORD, SO_UPDATE_CONNECT_CONTEXT); 1344 WINAPI_CONSTANT(F_DWORD, SO_UPDATE_CONNECT_CONTEXT);
1343 WINAPI_CONSTANT(F_DWORD, TF_REUSE_SOCKET); 1345 WINAPI_CONSTANT(F_DWORD, TF_REUSE_SOCKET);
1344 1346
1345 return m; 1347 return m;
1346 } 1348 }
OLDNEW

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+