Skip to content

Commit 26a72e1

Browse files
mattipjreback
authored andcommitted
CLN: move assignment from header into cython (#14731)
1 parent 6ad6e4e commit 26a72e1

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

pandas/src/datetime.pxd

-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ cdef extern from "datetime.h":
4242
object PyDateTime_FromDateAndTime(int year, int month, int day, int hour,
4343
int minute, int second, int us)
4444

45-
cdef extern from "datetime_helper.h":
46-
void mangle_nat(object o)
47-
4845
cdef extern from "numpy/ndarrayobject.h":
4946

5047
ctypedef int64_t npy_timedelta

pandas/src/datetime_helper.h

-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
#define PyInt_AS_LONG PyLong_AsLong
88
#endif
99

10-
void mangle_nat(PyObject *val) {
11-
PyDateTime_GET_MONTH(val) = -1;
12-
PyDateTime_GET_DAY(val) = -1;
13-
}
14-
1510
npy_int64 get_long_attr(PyObject *o, const char *attr) {
1611
npy_int64 long_val;
1712
PyObject *value = PyObject_GetAttrString(o, attr);

pandas/tslib.pyx

+2-1
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,8 @@ class NaTType(_NaT):
803803
cdef _NaT base
804804

805805
base = _NaT.__new__(cls, 1, 1, 1)
806-
mangle_nat(base)
806+
base._day = -1
807+
base._month = -1
807808
base.value = NPY_NAT
808809

809810
return base

0 commit comments

Comments
 (0)