gh-124956: Use `#undef` for temp macros in `_csv.c` (#124957)

This commit is contained in:
sobolevn 2024-10-07 20:35:56 +03:00 committed by GitHub
parent d1453f60c2
commit 51d426dc03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -367,6 +367,8 @@ static struct PyMemberDef Dialect_memberlist[] = {
{ NULL } { NULL }
}; };
#undef D_OFF
static PyGetSetDef Dialect_getsetlist[] = { static PyGetSetDef Dialect_getsetlist[] = {
{ "delimiter", (getter)Dialect_get_delimiter}, { "delimiter", (getter)Dialect_get_delimiter},
{ "escapechar", (getter)Dialect_get_escapechar}, { "escapechar", (getter)Dialect_get_escapechar},
@ -502,6 +504,7 @@ dialect_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
DIALECT_GETATTR(skipinitialspace, "skipinitialspace"); DIALECT_GETATTR(skipinitialspace, "skipinitialspace");
DIALECT_GETATTR(strict, "strict"); DIALECT_GETATTR(strict, "strict");
} }
#undef DIALECT_GETATTR
/* check types and convert to C values */ /* check types and convert to C values */
#define DIASET(meth, name, target, src, dflt) \ #define DIASET(meth, name, target, src, dflt) \
@ -515,6 +518,7 @@ dialect_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
DIASET(_set_int, "quoting", &self->quoting, quoting, QUOTE_MINIMAL); DIASET(_set_int, "quoting", &self->quoting, quoting, QUOTE_MINIMAL);
DIASET(_set_bool, "skipinitialspace", &self->skipinitialspace, skipinitialspace, false); DIASET(_set_bool, "skipinitialspace", &self->skipinitialspace, skipinitialspace, false);
DIASET(_set_bool, "strict", &self->strict, strict, false); DIASET(_set_bool, "strict", &self->strict, strict, false);
#undef DIASET
/* validate options */ /* validate options */
if (dialect_check_quoting(self->quoting)) if (dialect_check_quoting(self->quoting))
@ -1026,6 +1030,8 @@ static struct PyMemberDef Reader_memberlist[] = {
{ NULL } { NULL }
}; };
#undef R_OFF
static PyType_Slot Reader_Type_slots[] = { static PyType_Slot Reader_Type_slots[] = {
{Py_tp_doc, (char*)Reader_Type_doc}, {Py_tp_doc, (char*)Reader_Type_doc},
@ -1441,6 +1447,8 @@ static struct PyMemberDef Writer_memberlist[] = {
{ NULL } { NULL }
}; };
#undef W_OFF
static int static int
Writer_traverse(WriterObj *self, visitproc visit, void *arg) Writer_traverse(WriterObj *self, visitproc visit, void *arg)
{ {