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

Delta Between Two Patch Sets: Objects/funcobject.c

Issue 29259: Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects
Left Patch Set: Created 3 years ago
Right Patch Set: Created 3 years 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 1
2 /* Function object implementation */ 2 /* Function object implementation */
3 3
4 #include "Python.h" 4 #include "Python.h"
5 #include "code.h" 5 #include "code.h"
6 #include "structmember.h" 6 #include "structmember.h"
7 7
8 PyObject * 8 PyObject *
9 PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname ) 9 PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname )
10 { 10 {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 315 }
316 Py_INCREF(value); 316 Py_INCREF(value);
317 Py_XSETREF(op->func_qualname, value); 317 Py_XSETREF(op->func_qualname, value);
318 return 0; 318 return 0;
319 } 319 }
320 320
321 static PyObject * 321 static PyObject *
322 func_get_defaults(PyFunctionObject *op) 322 func_get_defaults(PyFunctionObject *op)
323 { 323 {
324 if (op->func_defaults == NULL) { 324 if (op->func_defaults == NULL) {
325 Py_INCREF(Py_None); 325 Py_RETURN_NONE;
326 return Py_None;
327 } 326 }
328 Py_INCREF(op->func_defaults); 327 Py_INCREF(op->func_defaults);
329 return op->func_defaults; 328 return op->func_defaults;
330 } 329 }
331 330
332 static int 331 static int
333 func_set_defaults(PyFunctionObject *op, PyObject *value) 332 func_set_defaults(PyFunctionObject *op, PyObject *value)
334 { 333 {
335 /* Legal to del f.func_defaults. 334 /* Legal to del f.func_defaults.
336 * Can only set func_defaults to NULL or a tuple. */ 335 * Can only set func_defaults to NULL or a tuple. */
337 if (value == Py_None) 336 if (value == Py_None)
338 value = NULL; 337 value = NULL;
339 if (value != NULL && !PyTuple_Check(value)) { 338 if (value != NULL && !PyTuple_Check(value)) {
340 PyErr_SetString(PyExc_TypeError, 339 PyErr_SetString(PyExc_TypeError,
341 "__defaults__ must be set to a tuple object"); 340 "__defaults__ must be set to a tuple object");
342 return -1; 341 return -1;
343 } 342 }
344 Py_XINCREF(value); 343 Py_XINCREF(value);
345 Py_XSETREF(op->func_defaults, value); 344 Py_XSETREF(op->func_defaults, value);
346 return 0; 345 return 0;
347 } 346 }
348 347
349 static PyObject * 348 static PyObject *
350 func_get_kwdefaults(PyFunctionObject *op) 349 func_get_kwdefaults(PyFunctionObject *op)
351 { 350 {
352 if (op->func_kwdefaults == NULL) { 351 if (op->func_kwdefaults == NULL) {
353 Py_INCREF(Py_None); 352 Py_RETURN_NONE;
354 return Py_None;
355 } 353 }
356 Py_INCREF(op->func_kwdefaults); 354 Py_INCREF(op->func_kwdefaults);
357 return op->func_kwdefaults; 355 return op->func_kwdefaults;
358 } 356 }
359 357
360 static int 358 static int
361 func_set_kwdefaults(PyFunctionObject *op, PyObject *value) 359 func_set_kwdefaults(PyFunctionObject *op, PyObject *value)
362 { 360 {
363 if (value == Py_None) 361 if (value == Py_None)
364 value = NULL; 362 value = NULL;
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 PyStaticMethod_New(PyObject *callable) 981 PyStaticMethod_New(PyObject *callable)
984 { 982 {
985 staticmethod *sm = (staticmethod *) 983 staticmethod *sm = (staticmethod *)
986 PyType_GenericAlloc(&PyStaticMethod_Type, 0); 984 PyType_GenericAlloc(&PyStaticMethod_Type, 0);
987 if (sm != NULL) { 985 if (sm != NULL) {
988 Py_INCREF(callable); 986 Py_INCREF(callable);
989 sm->sm_callable = callable; 987 sm->sm_callable = callable;
990 } 988 }
991 return (PyObject *)sm; 989 return (PyObject *)sm;
992 } 990 }
LEFTRIGHT

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