Skip to content

DEBUG: Cython failures #61262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions pandas/_libs/tslibs/timedeltas.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ cpdef int64_t get_unit_for_round(freq, NPY_DATETIMEUNIT creso) except? -1
cpdef int64_t delta_to_nanoseconds(
delta, NPY_DATETIMEUNIT reso=*, bint round_ok=*
) except? -1
cpdef int64_t debug_divmod_bug(delta) except? -1
cpdef debug_2()
cdef convert_to_timedelta64(object ts, str unit)
cdef bint is_any_td_scalar(object obj)

Expand Down
22 changes: 22 additions & 0 deletions pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,28 @@ def ints_to_pytimedelta(ndarray m8values, box=False):
# ----------------------------------------------------------------------


cpdef debug_2():
cdef int64_t val = -420000000000
us, remainder = divmod(val, 1000)
if remainder >= 500:
us += 1
return us


cpdef int64_t debug_divmod_bug(delta) except? -1:
cdef int64_t n, div, mod, conv = 1000 * 1
if PyDelta_Check(delta):
n = (
delta.days * 24 * 3600 * 1_000_000
+ delta.seconds * 1_000_000
+ delta.microseconds
)
else:
raise ValueError("only timedelta is supported")
div, mod = divmod(n, conv)
return div


cpdef int64_t delta_to_nanoseconds(
delta,
NPY_DATETIMEUNIT reso=NPY_FR_ns,
Expand Down
Empty file removed pandas/tests/api/__init__.py
Empty file.
Loading
Loading