Skip to content

Commit

Permalink
Merge pull request #3159 from minrk/deprecation-stacklevel
Browse files Browse the repository at this point in the history
Add stacklevel to deprecation warnings
  • Loading branch information
bdarnell committed Jun 17, 2022
2 parents 713f06b + 019fd52 commit be44f6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tornado/ioloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,11 @@ def clear_current() -> None:
This method also clears the current `asyncio` event loop.
.. deprecated:: 6.2
"""
warnings.warn("clear_current is deprecated", DeprecationWarning)
warnings.warn(
"clear_current is deprecated",
DeprecationWarning,
stacklevel=2,
)
IOLoop._clear_current()

@staticmethod
Expand Down
2 changes: 2 additions & 0 deletions tornado/platform/asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ def make_current(self) -> None:
warnings.warn(
"make_current is deprecated; start the event loop first",
DeprecationWarning,
stacklevel=2,
)
if not self.is_current:
try:
Expand Down Expand Up @@ -425,6 +426,7 @@ def __init__(self) -> None:
"AnyThreadEventLoopPolicy is deprecated, use asyncio.run "
"or asyncio.new_event_loop instead",
DeprecationWarning,
stacklevel=2,
)

def get_event_loop(self) -> asyncio.AbstractEventLoop:
Expand Down

0 comments on commit be44f6f

Please sign in to comment.