Skip to content

Commit

Permalink
pythongh-124956: Use #undef for temp macros in _csv.c
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Oct 4, 2024
1 parent c066bf5 commit 4022d47
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Modules/_csv.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ static struct PyMemberDef Dialect_memberlist[] = {
{ NULL }
};

#undef D_OFF

static PyGetSetDef Dialect_getsetlist[] = {
{ "delimiter", (getter)Dialect_get_delimiter},
{ "escapechar", (getter)Dialect_get_escapechar},
Expand Down Expand Up @@ -502,6 +504,7 @@ dialect_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
DIALECT_GETATTR(skipinitialspace, "skipinitialspace");
DIALECT_GETATTR(strict, "strict");
}
#undef DIALECT_GETATTR

/* check types and convert to C values */
#define DIASET(meth, name, target, src, dflt) \
Expand All @@ -515,6 +518,7 @@ dialect_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
DIASET(_set_int, "quoting", &self->quoting, quoting, QUOTE_MINIMAL);
DIASET(_set_bool, "skipinitialspace", &self->skipinitialspace, skipinitialspace, false);
DIASET(_set_bool, "strict", &self->strict, strict, false);
#undef DIASET

/* validate options */
if (dialect_check_quoting(self->quoting))
Expand Down Expand Up @@ -1026,6 +1030,8 @@ static struct PyMemberDef Reader_memberlist[] = {
{ NULL }
};

#undef R_OFF


static PyType_Slot Reader_Type_slots[] = {
{Py_tp_doc, (char*)Reader_Type_doc},
Expand Down Expand Up @@ -1441,6 +1447,8 @@ static struct PyMemberDef Writer_memberlist[] = {
{ NULL }
};

#undef W_OFF

static int
Writer_traverse(WriterObj *self, visitproc visit, void *arg)
{
Expand Down

0 comments on commit 4022d47

Please sign in to comment.