summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-22 22:21:34 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-08-22 22:21:34 (GMT)
commit6412f4993ab497de7e15e2578da52fc2a9c14f1d (patch)
treecab1643e713bdbbeef354a2f20b81c4dd9ce9d88
parentd1584d3e7e9aeb4d9c9708d0ec5522ab58ae1853 (diff)
downloadcpython-6412f4993ab497de7e15e2578da52fc2a9c14f1d.zip
cpython-6412f4993ab497de7e15e2578da52fc2a9c14f1d.tar.gz
cpython-6412f4993ab497de7e15e2578da52fc2a9c14f1d.tar.bz2
Issue #27809: _csv: _call_dialect() uses fast call
-rw-r--r--Modules/_csv.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/Modules/_csv.c b/Modules/_csv.c
index ef2e7d7..7a78541 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -518,15 +518,13 @@ static PyTypeObject Dialect_Type = {
static PyObject *
_call_dialect(PyObject *dialect_inst, PyObject *kwargs)
{
- PyObject *ctor_args;
- PyObject *dialect;
-
- ctor_args = Py_BuildValue(dialect_inst ? "(O)" : "()", dialect_inst);
- if (ctor_args == NULL)
- return NULL;
- dialect = PyObject_Call((PyObject *)&Dialect_Type, ctor_args, kwargs);
- Py_DECREF(ctor_args);
- return dialect;
+ PyObject *type = (PyObject *)&Dialect_Type;
+ if (dialect_inst) {
+ return _PyObject_FastCallDict(type, &dialect_inst, 1, kwargs);
+ }
+ else {
+ return _PyObject_FastCallDict(type, NULL, 0, kwargs);
+ }
}
/*