Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

Commit f9a461e

Browse files
committed
updated macro locations, undef macros after use
1 parent f4c94fc commit f9a461e

1 file changed

Lines changed: 21 additions & 16 deletions

File tree

automap.c

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,23 @@ fam_values(FAMObject *self)
18321832
}
18331833

18341834

1835+
static PyObject *
1836+
fam_new(PyTypeObject *cls, PyObject *args, PyObject *kwargs)
1837+
{
1838+
// NOTE: The original fam_new used to be able to provide a same reference back if a fam was in the args; this is tricky now that we have fam_init
1839+
FAMObject *self = (FAMObject *)cls->tp_alloc(cls, 0);
1840+
if (!self) {
1841+
return NULL;
1842+
}
1843+
self->table = NULL;
1844+
self->keys = NULL;
1845+
self->key_buffer = NULL;
1846+
self->keys_size = 0;
1847+
1848+
return (PyObject*)self;
1849+
}
1850+
1851+
18351852
// This macro can be used with integer and floating point NumPy types, given an `npy_type` and a specialized `insert_func`. Uses context of `fam_init` to get `fam`, `contiguous`, `a`, `keys_size`, and `i`. An optional `pre_insert` function can be supplied to transform extracted values before calling the insert function.
18361853
# define INSERT_SCALARS(npy_type, insert_func, pre_insert) \
18371854
if (contiguous) { \
@@ -1882,22 +1899,6 @@ else { \
18821899
} \
18831900
} \
18841901

1885-
static PyObject *
1886-
fam_new(PyTypeObject *cls, PyObject *args, PyObject *kwargs)
1887-
{
1888-
// NOTE: The original fam_new used to be able to provide a same reference back if a fam was in the args; this is tricky now that we have fam_init
1889-
FAMObject *self = (FAMObject *)cls->tp_alloc(cls, 0);
1890-
if (!self) {
1891-
return NULL;
1892-
}
1893-
self->table = NULL;
1894-
self->keys = NULL;
1895-
self->key_buffer = NULL;
1896-
self->keys_size = 0;
1897-
1898-
return (PyObject*)self;
1899-
}
1900-
19011902

19021903
// Initialize an allocated FAMObject. Returns 0 on success, -1 on error.
19031904
int
@@ -2042,6 +2043,10 @@ fam_init(PyObject *self, PyObject *args, PyObject *kwargs)
20422043
}
20432044

20442045

2046+
# undef INSERT_SCALARS
2047+
# undef INSERT_FLEXIBLE
2048+
2049+
20452050
static PyObject *
20462051
fam_repr(FAMObject *self)
20472052
{

0 commit comments

Comments
 (0)