[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-12 Thread STINNER Victor
STINNER Victor added the comment: Thanks for the fixes Vinay and Serhiy! -- stage: patch review -> resolved status: open -> closed versions: +Python 3.10, Python 3.9 ___ Python tracker __

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 47a50fe16f9f074d3e6aa85e76502955ed40 by Miss Islington (bot) in branch '3.10': bpo-45401: Fix a resource warning in test_logging (GH-28864) (GH-28872) https://github.com/python/cpython/commit/47a50fe16f9f074d3e6aa85e76502955ed40

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset faa87f7f3b60f79b9018aaef0efa5e00d82b817b by Miss Islington (bot) in branch '3.9': bpo-45401: Fix a resource warning in test_logging (GH-28864) (GH-28873) https://github.com/python/cpython/commit/faa87f7f3b60f79b9018aaef0efa5e00d82b817b -

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread miss-islington
Change by miss-islington : -- pull_requests: +27171 pull_request: https://github.com/python/cpython/pull/28873 ___ Python tracker ___ __

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread miss-islington
Change by miss-islington : -- pull_requests: +27170 pull_request: https://github.com/python/cpython/pull/28872 ___ Python tracker ___ __

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread STINNER Victor
STINNER Victor added the comment: New changeset 5aca34f17c4baf8e4882a7e8a827cff06ac6ef25 by Miss Islington (bot) in branch '3.10': bpo-45401: Change shouldRollover() methods to only rollover regular f… (GH-28822) (#28867) https://github.com/python/cpython/commit/5aca34f17c4baf8e4882a7e8a827cf

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread STINNER Victor
STINNER Victor added the comment: New changeset ac421c348bf422f9a0d85fe0a1de3fa3f4886650 by Miss Islington (bot) in branch '3.9': bpo-45401: Change shouldRollover() methods to only rollover regular f… (GH-28822) (#28866) https://github.com/python/cpython/commit/ac421c348bf422f9a0d85fe0a1de3fa

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread miss-islington
Change by miss-islington : -- pull_requests: +27167 pull_request: https://github.com/python/cpython/pull/28866 ___ Python tracker ___ __

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread miss-islington
Change by miss-islington : -- pull_requests: +27168 pull_request: https://github.com/python/cpython/pull/28867 ___ Python tracker ___ __

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 15188b115a2da815556053372c912a81a74be43b by Serhiy Storchaka in branch 'main': bpo-45401: Fix a resource warning in test_logging (GH-28864) https://github.com/python/cpython/commit/15188b115a2da815556053372c912a81a74be43b -- ___

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread STINNER Victor
STINNER Victor added the comment: > $ ./python -X tracemalloc -m test -v test_logging -m test_should_not_rollover FYI you can use -X tracemalloc=10 to get a more complete traceback. -- ___ Python tracker __

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread STINNER Victor
STINNER Victor added the comment: Vinay: Oh, thanks for the fix! Using os.path.isfile() is a reasonable fix to detect if the file is a device. -- ___ Python tracker ___ _

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +27166 pull_request: https://github.com/python/cpython/pull/28865 ___ Python tracker ___ __

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +27165 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/28864 ___ Python tracker ___

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: With tracemalloc enabled: $ ./python -X tracemalloc -m test -v test_logging -m test_should_not_rollover ... test_should_not_rollover (test.test_logging.TimedRotatingFileHandlerTest) ... /home/serhiy/py/cpython/Lib/unittest/case.py:547: ResourceWarning: uncl

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: test_should_not_rollover (test.test_logging.TimedRotatingFileHandlerTest) ... /home/serhiy/py/cpython/Lib/unittest/case.py:547: ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' mode='a' encoding='utf-8'> if method() is not None: Resource

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-10 Thread Vinay Sajip
Vinay Sajip added the comment: Where did you see the warnings? I didn't spot anything in the GitHub Actions logs. -- ___ Python tracker ___ __

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-10 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- status: closed -> open ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Seems it introduced a resource warning in tests. -- ___ Python tracker ___ ___ Python-bugs-list

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-10 Thread Vinay Sajip
Change by Vinay Sajip : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ P

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-10 Thread miss-islington
miss-islington added the comment: New changeset 62a667784ba7b84611ebd50fa8a1a464cde32235 by Vinay Sajip in branch 'main': bpo-45401: Change shouldRollover() methods to only rollover regular f… (GH-28822) https://github.com/python/cpython/commit/62a667784ba7b84611ebd50fa8a1a464cde32235 -

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-08 Thread Vinay Sajip
Change by Vinay Sajip : -- keywords: +patch pull_requests: +27140 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28822 ___ Python tracker ___

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-08 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-07 Thread Vinay Sajip
Vinay Sajip added the comment: RotatingFileHandler is also affected by the same issue. Both RotatingFileHandler and TimedRotatingFileHandler have a shouldRollover method which, if it returns False, should prevent rollover. I would think that putting something like if not os.path.isfile(

[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-07 Thread STINNER Victor
New submission from STINNER Victor : One way to disable logging in a configuration file is to use /dev/null as the filename for logs. It is fine to use that with FileHandler. The problem is when TimedRotatingFileHandler is used. When Python decides to rotate the "file", it calls os.rename() o