New submission from Venkatesh-Prasad Ranganath <rvprasad.f...@gmail.com>:

`logging.Logger.disabled` field is assigned `False` while initializing 
`logging.Logger` instance and never updated.  However, this field is also 
involved in two checks: 
https://github.com/python/cpython/blob/da1fe768e582387212201ab8737a1a5f26110664/Lib/logging/__init__.py#L1586
 and 
https://github.com/python/cpython/blob/da1fe768e582387212201ab8737a1a5f26110664/Lib/logging/__init__.py#L1681
 that are executed in the context of every logging method.  So, these checks 
are likely to contribute to unnecessary computation while logging.

Further, since the library documentation does not mention this field, the field 
is probably not part of the public API of the logging library.  So, the field 
seems to be redundant.

Given the checks on the hot paths are redundant as the field never changes 
value and fields is not part of the public API, removing it will help improve 
logging performance and simplify the code base.

----------
components: Library (Lib)
messages: 364612
nosy: rvprasad
priority: normal
severity: normal
status: open
title: logging.Logger.disabled field is redundant
type: performance
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40015>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to