Skip to content

Commit 5d07e6e

Browse files
committed
Define return of iso_calendar as ctypedef
1 parent 3733dcc commit 5d07e6e

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

pandas/_libs/tslibs/ccalendar.pxd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ from cython cimport Py_ssize_t
22

33
from numpy cimport int64_t, int32_t
44

5+
ctypedef (int32_t, int32_t, int32_t) iso_calendar_t
56

67
cdef int dayofweek(int y, int m, int d) nogil
78
cdef bint is_leapyear(int64_t year) nogil
89
cpdef int32_t get_days_in_month(int year, Py_ssize_t month) nogil
910
cpdef int32_t get_week_of_year(int year, int month, int day) nogil
10-
cpdef (int32_t, int32_t, int32_t) get_iso_calendar(int year, int month, int day) nogil
11+
cpdef iso_calendar_t get_iso_calendar(int year, int month, int day) nogil
1112
cpdef int32_t get_day_of_year(int year, int month, int day) nogil

pandas/_libs/tslibs/ccalendar.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ cpdef int32_t get_week_of_year(int year, int month, int day) nogil:
159159

160160
@cython.wraparound(False)
161161
@cython.boundscheck(False)
162-
cpdef (int32_t, int32_t, int32_t) get_iso_calendar(int year, int month, int day) nogil:
162+
cpdef iso_calendar_t get_iso_calendar(int year, int month, int day) nogil:
163163
"""
164164
Return the year, week, and day of year corresponding to ISO 8601
165165

pandas/_libs/tslibs/fields.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ from pandas._libs.tslibs.ccalendar import (
1515
get_locale_names, MONTHS_FULL, DAYS_FULL, DAY_SECONDS)
1616
from pandas._libs.tslibs.ccalendar cimport (
1717
get_days_in_month, is_leapyear, dayofweek, get_week_of_year,
18-
get_day_of_year, get_iso_calendar)
18+
get_day_of_year, get_iso_calendar, iso_calendar_t)
1919
from pandas._libs.tslibs.np_datetime cimport (
2020
npy_datetimestruct, pandas_timedeltastruct, dt64_to_dtstruct,
2121
td64_to_tdstruct)
@@ -683,7 +683,7 @@ def build_isocalendar_sarray(const int64_t[:] dtindex):
683683
Py_ssize_t i, count = len(dtindex)
684684
npy_datetimestruct dts
685685
ndarray[int32_t] iso_years, iso_weeks, days
686-
(int32_t, int32_t, int32_t) ret_val
686+
iso_calendar_t ret_val
687687

688688
sa_dtype = [
689689
("year", "i4"),

0 commit comments

Comments
 (0)