Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add stacklevel 2 for raised message
  • Loading branch information
asvetlov committed Dec 21, 2017
commit b2b4a7eae01a788a75d09460a0eefbb9cfd9ffce
3 changes: 2 additions & 1 deletion Lib/asyncio/unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def close(self):
self.remove_signal_handler(sig)
else:
warinigs.warn(f"Closing the loop {self} on interpreter shutdown "

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace {self} with {self!r}. See for example BaseEventLoop.close() resource warning.

f"stage, signal unsubsription is disabled")
f"stage, signal unsubsription is disabled",
stacklevel=2)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that stacklevel=2 is correct. Maybe remove it?

For the warning category, I hesitate to use ResourceWarning and pass source=self. ResourceWarning are quiet by default. It's maybe better to not pollute stdout with such warning?


def _process_self_data(self, data):
for signum in data:
Expand Down