Skip to content

Commit f135ba3

Browse files
committed
fix stacklevel
1 parent a12aee2 commit f135ba3

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":
@@ -189,15 +190,15 @@ cdef inline object _parse_delimited_date(str date_string, bint dayfirst):
189190
format='MM/DD/YYYY',
190191
dayfirst='True',
191192
),
192-
stacklevel=4,
193+
stacklevel=find_stack_level(),
193194
)
194195
elif not dayfirst and swapped_day_and_month:
195196
warnings.warn(
196197
PARSING_WARNING_MSG.format(
197198
format='DD/MM/YYYY',
198199
dayfirst='False (the default)',
199200
),
200-
stacklevel=4,
201+
stacklevel=find_stack_level(),
201202
)
202203
# In Python <= 3.6.0 there is no range checking for invalid dates
203204
# in C api, thus we call faster C version for 3.6.1 or newer

0 commit comments

Comments
 (0)