-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Fix stacklevel dayfirst warning #47908
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
Fix stacklevel dayfirst warning #47908
Conversation
pandas/_testing/_warnings.py
Outdated
@@ -130,7 +130,8 @@ def _assert_caught_expected_warning( | |||
saw_warning = True | |||
|
|||
if check_stacklevel and issubclass( | |||
actual_warning.category, (FutureWarning, DeprecationWarning) | |||
actual_warning.category, | |||
(FutureWarning, DeprecationWarning, UserWarning), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test which checked the warning passes on main
because stacklevel is only checked for FutureWarning
and DeprecationWarning
@@ -63,6 +63,7 @@ from pandas._libs.tslibs.util cimport ( | |||
get_c_string_buf_and_size, | |||
is_array, | |||
) | |||
from pandas.util._exceptions import find_stack_level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbrockmendel any suggestions on how to do this without importing from outisde _libs
(as you'd previously requested on a different PR)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could import it when u need this (eg near usage)
or move the implementation to _libs itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a case where the rule-of-thumb preventing non-_libs imports is OK to break
f135ba3
to
4cf3d9b
Compare
OK thanks, I've stuck with the original import then I've made a separate issue about catching this incorrect stacklevel in tests, will address that separately if that's OK #47919 |
closing as I'm taking this forwards in #47998 |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.