Skip to content

Commit 4cf3d9b

Browse files
committed
fix stacklevel
1 parent 14de3fd commit 4cf3d9b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pandas/_libs/tslibs/parsing.pyx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ from pandas._libs.tslibs.util cimport (
6363
get_c_string_buf_and_size,
6464
is_array,
6565
)
66+
from pandas.util._exceptions import find_stack_level
6667

6768

6869
cdef extern from "../src/headers/portable.h":
@@ -214,15 +215,15 @@ cdef inline object _parse_delimited_date(str date_string, bint dayfirst):
214215
format='MM/DD/YYYY',
215216
dayfirst='True',
216217
),
217-
stacklevel=4,
218+
stacklevel=find_stack_level(),
218219
)
219220
elif not dayfirst and swapped_day_and_month:
220221
warnings.warn(
221222
PARSING_WARNING_MSG.format(
222223
format='DD/MM/YYYY',
223224
dayfirst='False (the default)',
224225
),
225-
stacklevel=4,
226+
stacklevel=find_stack_level(),
226227
)
227228
# In Python <= 3.6.0 there is no range checking for invalid dates
228229
# in C api, thus we call faster C version for 3.6.1 or newer

0 commit comments

Comments
 (0)