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

Side by Side Diff: Modules/_ctypes/_ctypes.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 ToDo: 2 ToDo:
3 3
4 Get rid of the checker (and also the converters) field in PyCFuncPtrObject and 4 Get rid of the checker (and also the converters) field in PyCFuncPtrObject and
5 StgDictObject, and replace them by slot functions in StgDictObject. 5 StgDictObject, and replace them by slot functions in StgDictObject.
6 6
7 think about a buffer-like object (memory? bytes?) 7 think about a buffer-like object (memory? bytes?)
8 8
9 Should POINTER(c_char) and POINTER(c_wchar) have a .value property? 9 Should POINTER(c_char) and POINTER(c_wchar) have a .value property?
10 What about c_char and c_wchar arrays then? 10 What about c_char and c_wchar arrays then?
(...skipping 3232 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 if (!PyArg_ParseTuple(args, "O|O", &ftuple, &paramflags)) 3243 if (!PyArg_ParseTuple(args, "O|O", &ftuple, &paramflags))
3244 return NULL; 3244 return NULL;
3245 if (paramflags == Py_None) 3245 if (paramflags == Py_None)
3246 paramflags = NULL; 3246 paramflags = NULL;
3247 3247
3248 ftuple = PySequence_Tuple(ftuple); 3248 ftuple = PySequence_Tuple(ftuple);
3249 if (!ftuple) 3249 if (!ftuple)
3250 /* Here ftuple is a borrowed reference */ 3250 /* Here ftuple is a borrowed reference */
3251 return NULL; 3251 return NULL;
3252 3252
3253 if (!PyArg_ParseTuple(ftuple, "O&O", _get_name, &name, &dll)) { 3253 if (!PyArg_ParseTuple(ftuple,
3254 "O&O;PyCFuncPtr.__new__: illegal function name and "
storchaka 2017/03/03 08:34:36 I think it would be better to omit PyCFuncPtr.__ne
Oren Milman 2017/08/16 16:09:26 I agree. to reproduce the bug: ctypes.CFUNCTYPE(N
3255 "dll object sequence argument",
3256 _get_name, &name, &dll)) {
3254 Py_DECREF(ftuple); 3257 Py_DECREF(ftuple);
3255 return NULL; 3258 return NULL;
3256 } 3259 }
3257 3260
3258 obj = PyObject_GetAttrString(dll, "_handle"); 3261 obj = PyObject_GetAttrString(dll, "_handle");
3259 if (!obj) { 3262 if (!obj) {
3260 Py_DECREF(ftuple); 3263 Py_DECREF(ftuple);
3261 return NULL; 3264 return NULL;
3262 } 3265 }
3263 if (!PyLong_Check(obj)) { 3266 if (!PyLong_Check(obj)) {
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after
5504 PyModule_AddObject(m, "ArgumentError", PyExc_ArgError); 5507 PyModule_AddObject(m, "ArgumentError", PyExc_ArgError);
5505 } 5508 }
5506 return m; 5509 return m;
5507 } 5510 }
5508 5511
5509 /* 5512 /*
5510 Local Variables: 5513 Local Variables:
5511 compile-command: "cd .. && python setup.py -q build -g && python setup.py -q bu ild install --home ~" 5514 compile-command: "cd .. && python setup.py -q build -g && python setup.py -q bu ild install --home ~"
5512 End: 5515 End:
5513 */ 5516 */
OLDNEW

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