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

Side by Side Diff: Python/ceval.c

Issue 27809: _PyObject_FastCall(): add support for keyword arguments
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:
View unified diff | Download patch
« no previous file with comments | « Objects/typeobject.c ('k') | Python/pythonrun.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* Execute compiled code */ 2 /* Execute compiled code */
3 3
4 /* XXX TO DO: 4 /* XXX TO DO:
5 XXX speed up searching for keywords by using a dictionary 5 XXX speed up searching for keywords by using a dictionary
6 XXX document it! 6 XXX document it!
7 */ 7 */
8 8
9 /* enable more aggressive intra-module optimizations, where available */ 9 /* enable more aggressive intra-module optimizations, where available */
10 #define PY_LOCAL_AGGRESSIVE 10 #define PY_LOCAL_AGGRESSIVE
(...skipping 4575 matching lines...) Expand 10 before | Expand all | Expand 10 after
4586 4586
4587 #ifdef Py_DEBUG 4587 #ifdef Py_DEBUG
4588 /* PyEval_CallObjectWithKeywords() must not be called with an exception 4588 /* PyEval_CallObjectWithKeywords() must not be called with an exception
4589 set. It raises a new exception if parameters are invalid or if 4589 set. It raises a new exception if parameters are invalid or if
4590 PyTuple_New() fails, and so the original exception is lost. */ 4590 PyTuple_New() fails, and so the original exception is lost. */
4591 assert(!PyErr_Occurred()); 4591 assert(!PyErr_Occurred());
4592 #endif 4592 #endif
4593 4593
4594 if (args == NULL) { 4594 if (args == NULL) {
4595 if (kwargs == NULL) { 4595 if (kwargs == NULL) {
4596 return _PyObject_FastCall(func, NULL, 0, 0); 4596 return _PyObject_CallNoArg(func);
4597 } 4597 }
4598 4598
4599 args = PyTuple_New(0); 4599 args = PyTuple_New(0);
4600 if (args == NULL) 4600 if (args == NULL)
4601 return NULL; 4601 return NULL;
4602 } 4602 }
4603 else if (!PyTuple_Check(args)) { 4603 else if (!PyTuple_Check(args)) {
4604 PyErr_SetString(PyExc_TypeError, 4604 PyErr_SetString(PyExc_TypeError,
4605 "argument list must be a tuple"); 4605 "argument list must be a tuple");
4606 return NULL; 4606 return NULL;
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
5291 return res; 5291 return res;
5292 } 5292 }
5293 5293
5294 Py_INCREF(import_func); 5294 Py_INCREF(import_func);
5295 5295
5296 stack[0] = name; 5296 stack[0] = name;
5297 stack[1] = f->f_globals; 5297 stack[1] = f->f_globals;
5298 stack[2] = f->f_locals == NULL ? Py_None : f->f_locals; 5298 stack[2] = f->f_locals == NULL ? Py_None : f->f_locals;
5299 stack[3] = fromlist; 5299 stack[3] = fromlist;
5300 stack[4] = level; 5300 stack[4] = level;
5301 res = _PyObject_FastCall(import_func, stack, 5, NULL); 5301 res = _PyObject_FastCall(import_func, stack, 5);
5302 Py_DECREF(import_func); 5302 Py_DECREF(import_func);
5303 return res; 5303 return res;
5304 } 5304 }
5305 5305
5306 static PyObject * 5306 static PyObject *
5307 import_from(PyObject *v, PyObject *name) 5307 import_from(PyObject *v, PyObject *name)
5308 { 5308 {
5309 PyObject *x; 5309 PyObject *x;
5310 _Py_IDENTIFIER(__name__); 5310 _Py_IDENTIFIER(__name__);
5311 PyObject *fullmodname, *pkgname; 5311 PyObject *fullmodname, *pkgname;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
5524 Py_DECREF(l); 5524 Py_DECREF(l);
5525 return NULL; 5525 return NULL;
5526 } 5526 }
5527 PyList_SetItem(l, i, x); 5527 PyList_SetItem(l, i, x);
5528 } 5528 }
5529 return l; 5529 return l;
5530 #endif 5530 #endif
5531 } 5531 }
5532 5532
5533 #endif 5533 #endif
OLDNEW
« no previous file with comments | « Objects/typeobject.c ('k') | Python/pythonrun.c » ('j') | no next file with comments »

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