This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: lib2to3 BaseFix class creates un-needed loggers leading to refleaks
Type: behavior Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool), Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, eric.araujo, python-dev, vinay.sajip
Priority: normal Keywords: easy

Created on 2011-07-11 17:58 by vinay.sajip, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg140155 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-07-11 17:58
See #12167 for background.

The BaseFix class creates a logger named with the filename when the set_filename method is called. This logger appears to never be used, but since set_filename could be called any number of times and loggers are effectively singletons and not garbage collected, this could lead to refleaks and unbounded memory usage for no benefit.

It's possible to output contextual information about a file being worked on without needing to create a logger with the filename.

I'm proposing that the references to the logger in BaseFix be removed, as the logger isn't used anyway, and the test suite runs without failures when the references are removed. This will allow progress on #12167.
msg140254 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-07-13 14:24
If the logger attribute is part of the official API and Benjamin doesn’t think it wise to just remove it, I think we should either start deprecating it (using a property), or set it to a shared logger object instead of creating one per file.
msg140257 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-07-13 14:34
I say kill the loggers.
msg140313 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-07-13 22:15
New changeset dd004e85e299 by Vinay Sajip in branch 'default':
Closes #12536: Unused logger removed from lib2to3.
http://hg.python.org/cpython/rev/dd004e85e299
History
Date User Action Args
2022-04-11 14:57:19adminsetgithub: 56745
2011-07-13 22:15:16python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg140313

resolution: fixed
stage: resolved
2011-07-13 14:34:06benjamin.petersonsetmessages: + msg140257
2011-07-13 14:24:05eric.araujosetmessages: + msg140254
2011-07-11 17:58:20vinay.sajipcreate