Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Include/internal/pycore_global_objects_fini_generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Include/internal/pycore_global_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,13 @@ struct _Py_global_strings {
STRUCT_FOR_ID(default)
STRUCT_FOR_ID(defaultaction)
STRUCT_FOR_ID(delete)
STRUCT_FOR_ID(delimiter)
STRUCT_FOR_ID(depth)
STRUCT_FOR_ID(desired_access)
STRUCT_FOR_ID(detect_types)
STRUCT_FOR_ID(deterministic)
STRUCT_FOR_ID(device)
STRUCT_FOR_ID(dialect)
STRUCT_FOR_ID(dict)
STRUCT_FOR_ID(difference_update)
STRUCT_FOR_ID(digest)
Expand All @@ -452,6 +454,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(doc)
STRUCT_FOR_ID(done)
STRUCT_FOR_ID(dont_inherit)
STRUCT_FOR_ID(doublequote)
STRUCT_FOR_ID(dst)
STRUCT_FOR_ID(dst_dir_fd)
STRUCT_FOR_ID(duration_sec)
Expand All @@ -470,6 +473,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(env)
STRUCT_FOR_ID(error_rate)
STRUCT_FOR_ID(errors)
STRUCT_FOR_ID(escapechar)
STRUCT_FOR_ID(event)
STRUCT_FOR_ID(eventmask)
STRUCT_FOR_ID(exc)
Expand Down Expand Up @@ -630,6 +634,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(line)
STRUCT_FOR_ID(line_buffering)
STRUCT_FOR_ID(lineno)
STRUCT_FOR_ID(lineterminator)
STRUCT_FOR_ID(little)
STRUCT_FOR_ID(lo)
STRUCT_FOR_ID(locale)
Expand Down Expand Up @@ -761,7 +766,9 @@ struct _Py_global_strings {
STRUCT_FOR_ID(qualname)
STRUCT_FOR_ID(query)
STRUCT_FOR_ID(queuetype)
STRUCT_FOR_ID(quotechar)
STRUCT_FOR_ID(quotetabs)
STRUCT_FOR_ID(quoting)
STRUCT_FOR_ID(random_func)
STRUCT_FOR_ID(raw)
STRUCT_FOR_ID(read)
Expand Down Expand Up @@ -827,6 +834,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(sizehint)
STRUCT_FOR_ID(skip_file_prefixes)
STRUCT_FOR_ID(skip_non_matching_threads)
STRUCT_FOR_ID(skipinitialspace)
STRUCT_FOR_ID(sleep)
STRUCT_FOR_ID(sock)
STRUCT_FOR_ID(sort)
Expand Down
8 changes: 8 additions & 0 deletions Include/internal/pycore_runtime_init_generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Include/internal/pycore_unicodeobject_generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 26 additions & 43 deletions Modules/_csv.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,19 +457,6 @@ Dialect_dealloc(PyObject *self)
Py_DECREF(tp);
}

static char *dialect_kws[] = {
"dialect",
"delimiter",
"doublequote",
"escapechar",
"lineterminator",
"quotechar",
"quoting",
"skipinitialspace",
"strict",
NULL
};

static _csvstate *
_csv_state_from_type(PyTypeObject *type, const char *name)
{
Expand All @@ -486,33 +473,31 @@ _csv_state_from_type(PyTypeObject *type, const char *name)
return module_state;
}

/*[clinic input]
@vectorcall
@classmethod
_csv.Dialect.__new__ as dialect_new
dialect: object(c_default="NULL") = None
delimiter: object(c_default="NULL") = None
doublequote: object(c_default="NULL") = None
escapechar: object(c_default="NULL") = None
lineterminator: object(c_default="NULL") = None
quotechar: object(c_default="NULL") = None
quoting: object(c_default="NULL") = None
skipinitialspace: object(c_default="NULL") = None
strict: object(c_default="NULL") = None
[clinic start generated code]*/

static PyObject *
dialect_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
dialect_new_impl(PyTypeObject *type, PyObject *dialect, PyObject *delimiter,
PyObject *doublequote, PyObject *escapechar,
PyObject *lineterminator, PyObject *quotechar,
PyObject *quoting, PyObject *skipinitialspace,
PyObject *strict)
/*[clinic end generated code: output=123393bdc71ddaa6 input=a9977678df813ece]*/
{
DialectObj *self;
PyObject *ret = NULL;
PyObject *dialect = NULL;
PyObject *delimiter = NULL;
PyObject *doublequote = NULL;
PyObject *escapechar = NULL;
PyObject *lineterminator = NULL;
PyObject *quotechar = NULL;
PyObject *quoting = NULL;
PyObject *skipinitialspace = NULL;
PyObject *strict = NULL;

if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|OOOOOOOOO", dialect_kws,
&dialect,
&delimiter,
&doublequote,
&escapechar,
&lineterminator,
&quotechar,
&quoting,
&skipinitialspace,
&strict))
return NULL;

_csvstate *module_state = _csv_state_from_type(type, "dialect_new");
if (module_state == NULL) {
Expand Down Expand Up @@ -676,13 +661,10 @@ static PyObject *
_csv_Dialect___replace___impl(DialectObj *self, PyObject *changes)
/*[clinic end generated code: output=8f692c2c63a61b50 input=154beb565fbabd4c]*/
{
PyObject *newargs = PyTuple_Pack(1, self);
if (newargs == NULL) {
return NULL;
}
PyObject *result = dialect_new(Py_TYPE(self), newargs, changes);
Py_DECREF(newargs);
return result;
PyObject *const args[1] = {(PyObject *)self};
return dialect_new_helper(Py_TYPE(self), args, 1,
changes ? PyDict_GET_SIZE(changes) : 0,
changes, NULL);
}

static struct PyMethodDef dialect_methods[] = {
Expand Down Expand Up @@ -719,6 +701,7 @@ static PyType_Slot Dialect_Type_slots[] = {
{Py_tp_members, Dialect_memberlist},
{Py_tp_getset, Dialect_getsetlist},
{Py_tp_new, dialect_new},
{Py_tp_vectorcall, dialect_vectorcall},
{Py_tp_methods, dialect_methods},
{Py_tp_dealloc, Dialect_dealloc},
{Py_tp_clear, Dialect_clear},
Expand Down
Loading
Loading