FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-90535: Warn of deprecation of intervals other than 1 with `when='MIDNIGHT'` by vsajip · Pull Request #98099 · python/cpython · GitHub

Repository navigation

gh-90535: Warn of deprecation of intervals other than 1 with when='MIDNIGHT' - #98099

Closed
vsajip wants to merge 2 commits into
python:mainfrom
vsajip:fix-90535
Closed

vsajip wants to merge 2 commits into
python:mainfrom
vsajip:fix-90535

Conversation

vsajip commented Oct 8, 2022 •
edited by brettcannon
Loading

Copy link
Copy Markdown
Member

vsajip self-assigned this Oct 8, 2022
vsajip requested a review from brettcannon October 8, 2022 19:38
brettcannon changed the title gh-90535: Warn of deprecation of intervals other than 1 with when='MI… gh-90535: Warn of deprecation of intervals other than 1 with when='MIDNIGHT' Nov 25, 2022
brettcannon changed the title gh-90535: Warn of deprecation of intervals other than 1 with when='MIDNIGHT' gh-90535: Warn of deprecation of intervals other than 1 with when=='MIDNIGHT' Nov 25, 2022
brettcannon changed the title gh-90535: Warn of deprecation of intervals other than 1 with when=='MIDNIGHT' gh-90535: Warn of deprecation of intervals other than 1 with when='MIDNIGHT' Nov 25, 2022
Comment thread Lib/test/test_logging.py
self.fn, encoding="utf-8", when='MIDNIGHT', interval=2, backupCount=0,
utc=True)
rh.close()
if w:

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Do you want the test to pass if no warning is raised? If not then in the above I would force deprecations on as exceptions via warnings.simplefilter("error").

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Good point. Thanks for the review, Brett.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why not use assertWarns()?

serhiy-storchaka left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I do not think that this change is needed. What if you want to roll over at 4:00 every second night? What are the alternatives?

Comment thread Lib/logging/handlers.py
import queue
import threading
import copy
import warnings

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It is better to defer the warnings module import until it is needed (which never happen in normal case).

Comment thread Lib/test/test_logging.py
self.fn, encoding="utf-8", when='MIDNIGHT', interval=2, backupCount=0,
utc=True)
rh.close()
if w:

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why not use assertWarns()?

Copy link
Copy Markdown
Member

#116220 is an alternate solution, which fixes support of intervals>1 instead of deprecating it for when='MIDNIGHT' and when='Wx'.

Copy link
Copy Markdown
Member

I guess it can be closed now.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL