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

Side by Side Diff: Objects/abstract.c

Issue 11682: PEP 380 reference implementation for 3.3
Patch Set: Created 7 years, 8 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 /* Abstract Object Interface (many thanks to Jim Fulton) */ 1 /* Abstract Object Interface (many thanks to Jim Fulton) */
2 2
3 #include "Python.h" 3 #include "Python.h"
4 #include <ctype.h> 4 #include <ctype.h>
5 #include "structmember.h" /* we need the offsetof() macro from there */ 5 #include "structmember.h" /* we need the offsetof() macro from there */
6 #include "longintrepr.h" 6 #include "longintrepr.h"
7 7
8 8
9 9
10 /* Shorthands to return certain errors */ 10 /* Shorthands to return certain errors */
(...skipping 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after
2260 { 2260 {
2261 va_list va; 2261 va_list va;
2262 PyObject *func = NULL; 2262 PyObject *func = NULL;
2263 PyObject *retval = NULL; 2263 PyObject *retval = NULL;
2264 2264
2265 if (o == NULL || name == NULL) 2265 if (o == NULL || name == NULL)
2266 return null_error(); 2266 return null_error();
2267 2267
2268 func = PyObject_GetAttrString(o, name); 2268 func = PyObject_GetAttrString(o, name);
2269 if (func == NULL) { 2269 if (func == NULL) {
2270 PyErr_SetString(PyExc_AttributeError, name);
2271 return 0; 2270 return 0;
2272 } 2271 }
2273 2272
2274 va_start(va, format); 2273 va_start(va, format);
2275 retval = callmethod(func, format, va, 0); 2274 retval = callmethod(func, format, va, 0);
2276 va_end(va); 2275 va_end(va);
2277 return retval; 2276 return retval;
2278 } 2277 }
2279 2278
2280 PyObject * 2279 PyObject *
(...skipping 23 matching lines...) Expand all
2304 { 2303 {
2305 va_list va; 2304 va_list va;
2306 PyObject *func = NULL; 2305 PyObject *func = NULL;
2307 PyObject *retval; 2306 PyObject *retval;
2308 2307
2309 if (o == NULL || name == NULL) 2308 if (o == NULL || name == NULL)
2310 return null_error(); 2309 return null_error();
2311 2310
2312 func = PyObject_GetAttrString(o, name); 2311 func = PyObject_GetAttrString(o, name);
2313 if (func == NULL) { 2312 if (func == NULL) {
2314 PyErr_SetString(PyExc_AttributeError, name);
2315 return 0; 2313 return 0;
2316 } 2314 }
2317 va_start(va, format); 2315 va_start(va, format);
2318 retval = callmethod(func, format, va, 1); 2316 retval = callmethod(func, format, va, 1);
2319 va_end(va); 2317 va_end(va);
2320 return retval; 2318 return retval;
2321 } 2319 }
2322 2320
2323 PyObject * 2321 PyObject *
2324 _PyObject_CallMethodId_SizeT(PyObject *o, _Py_Identifier *name, char *format, .. .) 2322 _PyObject_CallMethodId_SizeT(PyObject *o, _Py_Identifier *name, char *format, .. .)
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 /* Free's a NULL terminated char** array of C strings. */ 2798 /* Free's a NULL terminated char** array of C strings. */
2801 void 2799 void
2802 _Py_FreeCharPArray(char *const array[]) 2800 _Py_FreeCharPArray(char *const array[])
2803 { 2801 {
2804 Py_ssize_t i; 2802 Py_ssize_t i;
2805 for (i = 0; array[i] != NULL; ++i) { 2803 for (i = 0; array[i] != NULL; ++i) {
2806 free(array[i]); 2804 free(array[i]);
2807 } 2805 }
2808 free((void*)array); 2806 free((void*)array);
2809 } 2807 }
OLDNEW

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